<div dir="ltr"><div dir="ltr"><div dir="ltr">The database_setup.py is incomplete, so it's a bit difficult to be sure here, but, going on a hunch and given the error, "dbs" is the class, while db is an *instance* attribute.<div><br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">File "activitytypes.py", line 27, in __init__<br>
     self.model = qts.QSqlTableModel(dbs.db)<br>
AttributeError: type object 'DBSetup' has no attribute 'db'<br></blockquote><div><br></div><div>The "type object" error is when trying to access a class (a type); an instance would have returned "AttributeError: 'DBSetup' object has no attribute 'db'".</div><div>So, I'd say there are at least two issues:</div><div><br></div><div>1. you're importing the DBSetup class, but you're not creating an instance (*);</div><div>2. the first argument of the QSqlTableModel constructor is the parent, and unless you use the db keyword, you'll get another exception, since QSqlDatabase is not a valid parent (it doesn't inherit from QObject); consider that if you don't use multiple database connections, the database argument is unnecessary, as Qt will always use the default connection if not specified.</div></div><div><br></div><div>Maurizio</div><div><br></div><div><div>* be aware that the "imports as" syntax should be used with care: there are very good reasons for which classes and variables use different letter casings, and if you import a class changing it to a lowercase name you might get easily confused, thinking that an object is an instance, while it's not. Also always consider the pros and cons of using such renamings: saving a few characters isn't always a major benefit, especially if you end up having 4 modules that have almost the same names: qtw, qtg, qtc and qts. Readability should *never* be underestimated.</div><div></div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">È difficile avere una convinzione precisa quando si parla delle ragioni del cuore. - "Sostiene Pereira", Antonio Tabucchi<br><a href="http://www.jidesk.net" target="_blank">http://www.jidesk.net</a></div></div></div>