> I'm having trouble figuring out why modules won't import through uwsgi. > As you can see the module imports fine from the command line: > > [bjung@vm10lnx0018 wsgi]$ python > Python 2.6.6 (r266:84292, Feb 28 2011, 16:50:45) > [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import flask >>>> > > However, If I try to import flask (or just about anything else), I get an > import error: > > [bjung@vm10lnx0018 wsgi]$ uwsgi -s ~/var/run/uwsgi.sock -p 4 -M > --pythonpath /usr/local/lib/python2.6/site-packages -w server > *** Starting uWSGI 0.9.6.8 (64bit) on [Fri Mar 4 18:37:37 2011] *** > compiled with version: 4.1.2 20080704 (Red Hat 4.1.2-46) > Python version: 2.6.6 (r266:84292, Feb 28 2011, 16:50:45) [GCC 4.1.2 > 20080704 (Red Hat 4.1.2-46)] > your memory page size is 4096 bytes > allocated 640 bytes (0 KB) for 1 request's buffer. > binding on UNIX socket: /home/bjung/var/run/uwsgi.sock > your server socket listen backlog is limited to 100 connections > added /usr/local/lib/python2.6/site-packages to pythonpath. > initializing hooks...done. > Traceback (most recent call last): > File "./server.py", line 7, in <module> > import flask > ImportError: No module named flask > > > If I explicitly add the path: --pythonpath > /usr/local/lib/python2.6/site-packages/Flask-0.6.1-py2.6.egg/ it will at > least see the flask module. > > What's going on here? > > Incidentally, some modules in site-packages work... for instance I can > import bsddb3 from my wsgi app. > > [bjung@vm10lnx0018 wsgi]$ ls -l /usr/local/lib/python2.6/site-packages/ > total 876 > -rwxr-xr-x 1 root root 85010 Feb 28 16:53 avlmodule.so > drwxr-xr-x 3 root root 4096 Mar 4 18:04 bottle-0.8.5-py2.6.egg > -rw-r--r-- 1 root root 87794 Mar 4 18:21 bottle.py > -rw-r--r-- 1 root root 331532 Feb 28 16:58 > bsddb3-5.1.1-py2.6-linux-x86_64.egg > -rw-r--r-- 1 root root 406 Mar 4 18:06 easy-install.pth > drwxr-xr-x 4 root root 4096 Mar 4 18:06 Flask-0.6.1-py2.6.egg > drwxr-xr-x 4 root root 4096 Mar 4 18:06 Jinja2-2.5.5-py2.6.egg > -rw-r--r-- 1 root root 119 Feb 28 16:50 README > -rw-rw-r-- 1 root root 333591 Feb 28 16:55 setuptools-0.6c11-py2.6.egg > -rw-r--r-- 1 root root 30 Feb 28 16:55 setuptools.pth > drwxr-xr-x 4 root root 4096 Feb 28 16:59 unittest2-0.5.1-py2.6.egg > drwxr-xr-x 4 root root 4096 Mar 4 16:45 web.py-0.34-py2.6.egg > drwxr-xr-x 4 root root 4096 Mar 4 18:06 Werkzeug-0.6.2-py2.6.egg > > _______________________________________________ > uWSGI mailing list > [email protected] > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi >
Why are you messing with pythonpath ? If your modules are already in the pythonpath do not modify it, in this way you will be sure to get the same configuration of python command line -- Roberto De Ioris http://unbit.it _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
