PythonistaAppTemplate icon indicating copy to clipboard operation
PythonistaAppTemplate copied to clipboard

import mysqldb discrepancy between template and Pythonista.app

Open Tkizzy opened this issue 9 years ago • 1 comments

So in my Script folder I have a subfolder called mysqldb. The same files in my script folder are synced to Pythonista using dropbox for portability

Script/mysqldb/.....

"import mysqldb" from a file in my script folder worked just fine allowing me to make database calls.

After the new version of the template dropped yesterday, after migrating my project to it, I had an import error that says

' "module" object has no attribute connect.'

I fixed the error by changing

import mysqldb to

from mysqldb import mysqldb

...Now the above change fixed the problem for the template. But if I run those same files from Pythonista I get "global name mysqldb is not defined"

I have the short term solution which is to do a

Try: import mysqldb except ImportError: from mysqldb import mysqldb

...but I sense there's a deeper issue here.

Tkizzy avatar Feb 19 '16 08:02 Tkizzy

Update: the pythonista 3 beta is different. neither of the two approaches work....

Tkizzy avatar Feb 20 '16 04:02 Tkizzy