how to get duplication of root id?
On 10 July 2011 08:56, ssc <[email protected]> wrote: > thanks for your quick reply! :-) > > i did all of the usual groundwork (check permissions, verify i'm > actually loading the right package and some more), but in the end, the > problem seemed so weird it was obvious something fundamental must be > wrong. > > 8 hours of sleep, revert all pending code changes, take a couple of > steps back and get a fresh look at the issue --> DOH! > > i'd shifted quite a lot of code back and forth, created, moved, > renamed packages and modules and in that process, a module ended up > having the same name as a package, so neither regular python code nor > the wsgi application code import it, i just didn't notice in the heat > of the coding battle. > > problem solved. > > thanks again for your help! :-) > > On Jul 9, 11:01 am, Graham Dumpleton <[email protected]> > wrote: > > On 8 July 2011 17:49, ssc <[email protected]> wrote: > > > > > sorry for cross-posting, i asked the same question at > > >http://stackoverflow.com/questions/6631826/mod-wsgi-import-python-mod.. > ., > > > but as i am unsure how many mod_wsgi experts are watching SO, i ask > > > here again. > > > > I saw it. I don't always answer stuff on SO because it is a horrible > > medium for back and forth debugging, something I expected with this. > > So, good to see you came here. > > > > That it says 'No module named conf.another_source_file' and not cannot > > import 'project_2' suggests it may be a permissions problem such that > > the user that application runs as under Apache can read the project_2 > > directory, but not perhaps some of the files within it. > > > > So, check the permissions. > > > > Also suggest you add print statements to project_2/__init__.py so > > writes something to log to verify that that is being imported and not > > finding a project_2 package from somewhere else. > > > > Graham > > > > > > > > > > > > > > > > > I have two python projects and both have a conf package: > > > > > /some_folder/project_1/ > > > some_source_file.py > > > conf/ > > > __init__.py > > > some_conf_file.py > > > > > /another_folder/project_2/ > > > another_source_file.py > > > conf/ > > > __init__.py > > > another_conf_file.py > > > > > For each project, I have created a .pth file in the site-packages > > > folder with this contents: > > > > > .../site-packages/project_1.pth: > > > import sys; sys.path.append('/some_folder/project_1/') > > > > > .../site-packages/project_2.pth: > > > import sys; sys.path.append('/another_folder/project_2/') > > > > > However, Python seems to only search the first subfolder it > > > encounters in any folders in sys.path for modules that are to be > > > imported, so the setup above only works for project_1: > > > > > this works: from conf import some_conf_file > > > this doesn't: from conf import another_conf_file > > > > > In order to fix this, I have turned project_1 and project_2 into > > > python packages and added a symlink in either, so I can access both > > > conf packages in a fully qualified fashion: > > > > > /some_folder/project_1/ > > > __init__.py > > > project_1 <-- symlink to . > > > some_source_file.py > > > conf/ > > > __init__.py > > > some_conf_file.py > > > > > /another_folder/project_2/ > > > __init__.py > > > project_2 <-- symlink to . > > > another_source_file.py > > > conf/ > > > __init__.py > > > another_conf_file.py > > > > > In an ordinary python script, I can now import modules from both conf > > > packages: > > > > > import project_1.conf.some_source_file > > > import project_2.conf.another_source_file > > > > > However, the second project is part of a WSGI application using the > > > mod_wsgi Apache module. > > > > > The wsgi 'start file' (i.e. the one with a wsgi suffix referenced in > > > the WSGIScriptAlias statement in the Apache config file for my virtual > > > server) successfully imports /another_folder/project_2/ > > > another_source_file which in turn is supposed to import project_2/conf/ > > > another_conf_file.py - and that import fails with > > > ImportError: No module named conf.another_source_file > > > > > /another_folder/project_2/ is in sys.path as printed out from > > > another_conf_file.py and the fact that the error message says > > > conf.another_source_file and not project_2.conf.another_source_file > > > leads me to believe that the python interpreter does actually find > > > project_2, but not project_2/conf. > > > > > Even more confusing is the fact that the same problem occurs when I > > > rename project_2/conf to project_2/conf_2. > > > > > I even tried using another subfolder project_2 instead of the symlink, > > > but I just can't seem to get this file to import. > > > > > Can anyone help me ? > > > > > -- > > > You received this message because you are subscribed to the Google > Groups "modwsgi" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > [email protected]. > > > For more options, visit this group athttp:// > groups.google.com/group/modwsgi?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/modwsgi?hl=en. > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
