Forums

Import Errors

I am trying to run my app on the PA server but it's not working: When I look in the server log I find this:

Traceback (most recent call last):
File "/bin/user_wsgi_wrapper.py", line 5, in <module>
from __future__ import division
ImportError
No module named __future__
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***

So as suggested in this thread I went to http://help.pythonanywhere.com/pages/DebuggingImportError/ and it said to try running the wsgi file directly so I ran it in my virtualenv by doing this :

python -i /var/www/www_my_domain_com_wsgi.py

and this gave me the error:

File "/usr/local/lib/python2.7/dist-packages/flask_whooshalchemy.py", line 18, in <module>
import flask.ext.sqlalchemy as flask_sqlalchemy
ImportError: No module named ext.sqlalchemy

Now this is an error I encountered while I was writing the app, and to get around it I had to change the import

import flask.ext.sqlalchemy as flask_sqlalchemy

directly in the /lib/python2.7/site-packages of my virtualenv.

I thought when the app ran on the PA server it would also get it's dependencies from this directory? I did navigate to /usr/local/lib/python2.7/dist-packages/flask_whooshalchemy.py by building the url https://www.pythonanywhere.com/user/authenticsclub/files... and then using nano to edit the file in the console but I get permission denied.

So now i'm stuck and am not sure what to do! Any help would be appreciated.

No module named __future__ is a very weird error. It looks like your virtualenv is somehow broken. Have you created it on PythonAnywhere or uploaded it from another computer? Virtualenvs are not portable.

Thats it! I uploaded the virtualenv. Thanks a lot