views:

245

answers:

1

I have a simple setup with my python libraries in /domains/somedomain.com/libs/ and all my tests run fine. I start WSGI with DJANGO_SETTINGS_MODULE to "somedomain.settings" where somedomain is a package in libs/

Suddenly, when adding pywapi.py into libs/ I can't import it when hitting the site. But, if I add 'import pywapi' to my wsgi script, it fails when hit by Apache, but succeeds if I just write it. the WSGI itself is actually adding libs/ to the path, so I know it should be there when running. The path is absolute, too, so any change in CWD shouldn't be causing this.

I can't think of anything else and I've been tinkering with it half of my otherwise productive morning.

+2  A: 

I think the problem is related with the permissions of that file. Check that the user running wsgi (apache user, usually) is capable of reading and writing the everything in the libs folder and specially capable of reading the file pywapi.py.

Julio Menendez
The original package was archived with 0300 and the www user couldnt read them. Didn't think about it, because I normally expect those permissions on a fresh package. Thanks!
ironfroggy
+1: It's always permissions. When it's not permissions, then it's the path. When it's not the path, it's trivial logic bugs. When it's not trivial logic bugs, it's hard.
S.Lott