Python Forum
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected argument
#10
(Feb-20-2017, 06:49 PM)Larz60+ Wrote: I can't run this as I don't use MySql, but I think
changing:
cls.__instance = super(MysqlPython, cls).__new__(cls, *args, **kwargs)
to:
cls.__instance = super(MysqlPython, self).__new__(cls, *args, **kwargs)
may be the issue

I tried this change and now I get 

Error:
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py" getMonitorInterval Traceback (most recent call last):   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 287, in <module>     QObject,main(sys.argv)   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 259, in main     app = Controller(sys.argv)   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 244, in __init__     environment = Environment()   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 34, in __init__     self.interval = AppSettings.getmonitorinterval(self)   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 78, in getmonitorinterval     _connection = MysqlPython('raspi', 'root', 'pwd', 'Demo')   File "/Users/jasonstockton/Qt programs/Demo/DemoQMLProgram/main.py", line 101, in __new__     cls.__instance = super(MysqlPython, self).__new__(cls, *args, **kwargs) NameError: name 'self' is not defined Process finished with exit code 1
Are the errors I am getting occurring because of MySQL or are they straight Python errors?  I was thinking the errors are coming from Python and would occur no matter what flavor of SQL I use.

(Feb-20-2017, 08:28 PM)Larz60+ Wrote: It is a straight forward procedure in any relational database management system that I have worked with to unload a complete schema to external files.

I don't know how to do this in MySQL, here's how it's done in sqlite3, MySql will have some sort of dump program
The database is one of mine:

sqlite3 StockMktDb
sqlite>
sqlite> .output StockMktDb.sql
sqlite> .dump
sqlite> .quit
partial results:
Output:
PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE ASXListed ( CompanyName VARCHAR, AsxSymbol VARCHAR, GicsIndustryGroup VARCHAR); INSERT INTO "ASXListed" VALUES('Company name','ASX code','GICS industry group'); INSERT INTO "ASXListed" VALUES('MOQ LIMITED','MOQ','Software & Services'); INSERT INTO "ASXListed" VALUES('1-PAGE LIMITED','1PG','Software & Services'); INSERT INTO "ASXListed" VALUES('1300 SMILES LIMITED','ONT','Health Care Equipment & Services'); INSERT INTO "ASXListed" VALUES('1ST AVAILABLE LTD','1ST','Health Care Equipment & Services'); INSERT INTO "ASXListed" VALUES('333D LIMITED','T3D','Food, Beverage & Tobacco');
However, that aside, once a database has been dumped to .sql files, it's

a simple procedure to reload in sqlite3.
sqlite3 newdb
sqlite> .read StockMktDb.sql
That's all there is to it

I think I figured out how I can make SQLite work.  As I've been trying to develop this app I've run into various issues and have gone down different paths that work or don't work and I had a thought in my head that wasn't accurate.  Talking through all of this made me look at it differently and realize this is a derp moment for me.  My QML is calling a Python slot to interact with the db which I was going to do with MySQL.  I just realized I can use SQLite in the slot instead.  I'll set the db name in Python and not worry about having to set it in QML.  I would still like to figure out why my SQL class above is throwing that error.
Reply


Messages In This Thread
Unexpected argument - by jstockton - Feb-20-2017, 05:53 PM
RE: Unexpected argument - by Larz60+ - Feb-20-2017, 06:20 PM
RE: Unexpected argument - by jstockton - Feb-20-2017, 06:24 PM
RE: Unexpected argument - by Larz60+ - Feb-20-2017, 06:26 PM
RE: Unexpected argument - by jstockton - Feb-20-2017, 06:37 PM
RE: Unexpected argument - by snippsat - Feb-20-2017, 06:44 PM
RE: Unexpected argument - by jstockton - Feb-20-2017, 06:52 PM
RE: Unexpected argument - by Larz60+ - Feb-20-2017, 06:49 PM
RE: Unexpected argument - by jstockton - Feb-21-2017, 01:27 AM
RE: Unexpected argument - by Larz60+ - Feb-20-2017, 08:28 PM
RE: Unexpected argument - by Larz60+ - Feb-21-2017, 02:30 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Django "Unexpected Keyword Argument 'min_value'" AstralWeeks 0 279 Mar-27-2024, 04:56 AM
Last Post: AstralWeeks
  TypeError: __init__() got an unexpected keyword argument 'value' Anldra12 7 22,821 May-11-2021, 06:35 PM
Last Post: deanhystad
  TypeError: coerce_kw_type() got an unexpected keyword argument 'dest' juniii 1 2,463 Apr-24-2020, 01:53 PM
Last Post: Jeff900
  SyntaxError: positional argument follows keyword argument syd_jat 3 5,889 Mar-03-2020, 08:34 AM
Last Post: buran
  __call__() got an unexpected keyword argument 'text' saba_keon 5 9,456 Apr-07-2018, 11:11 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020