On Thu, Mar 29, 2012 at 8:12 AM, C Anthony Risinger <[email protected]> wrote: > On Mar 29, 2012 6:06 AM, "Roberto De Ioris" <[email protected]> wrote: >> >> Are you importing with module=module mapping or with module=file ? >> >> pymodule-alias = foo=/var/bar >> >> should set the __path__ to /var/bar as here: >> >> http://projects.unbit.it/uwsgi/browser/plugins/python/python_plugin.c#L411 >> >> while >> >> pymodule-alias = foo=bar >> >> would be a pointer to 'bar' and so you should see its path. >> >> Can you paste some 'simple' example ? Maybe i have not got the point > > I'm doing the first, but no __path__ exists at all :-( ... > > Yeah this all blew up at the last second before bed, I gathered stuff up and > fired it off :-) > > It's buried in the output, but ill make a more specific example in about an > hour -- I was aliasing a directory/package, then importing it: > > […] > pymodule-alias = Self=/path/to/package-with-dashes/ > module = Self > […]
ok check this out: http://n.xtfx.me/test-uwsgi-alias.tgz file structure: ------------------------------------ test-uwsgi-alias |-- package-with-dashes | |-- __init__.py | |-- module.py | `-- subpackage | `-- __init__.py |-- test.ini `-- uwsgi ------------------------------------ test.ini: ------------------------------------ # cat test-uwsgi-alias/test.ini [uwsgi] master = true processes = 2 http-socket = :8000 pymodule-alias = Self=%dpackage-with-dashes/ module = Self ------------------------------------ (Self) package-with-dashes/__init__.py ------------------------------------ import sys, traceback print "\nRELATIVE import?" try: from . import module except ValueError,e: traceback.print_exc() print "\nABSOLUTE import?" try: import Self.subpackage as sp except ImportError,e: traceback.print_exc() print "\nWhat is defined?" print dir() print "\nAre we in sys.modules?" print 'Self' in sys.modules print "\nNO PATH!" print sys.modules['Self'].__path__ # won't make it here ... ------------------------------------ ... all other files are empty. the uWSGI binary included in the tarball is for x86_64 llnux (archlinux). -- C Anthony _______________________________________________ uWSGI mailing list [email protected] http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
