[mod_python] Troubles with including local modules

Jorey Bump list at joreybump.com
Tue May 30 10:29:32 EDT 2006

Pavel Roitberg wrote:
> Jim Gallacher wrote:
>> Pavel Roitberg wrote:
>>>   File "/home/pavel/data/webwork/python/index.py", line 3, in ?
>>>     from module import article
>>> ImportError: cannot import name article
>>> """
>>> It only works after python generates the according pyc files. (when I
>>> import them manually using the interpreter)
>> It's not clear to my why it works for pyc files, but not py files. 
>> Perhaps you could include your mod_python apache configuration 
>> (AddHandler, etc), and a code snippet.
> sure
> Apache Config:
> <Directory /home/pavel/data/webwork/python>
>     Options Indexes FollowSymLinks
>     AllowOverride FileInfo
>     SetHandler mod_python
>     PythonHandler index
>     PythonDebug On
>     Order allow,deny
>     allow from all
> </Directory>

Is it possible that your .py module is readable only by you, but when 
you import it manually it creates a .pyc file that is also readable by 
the web server? What are the permissions on your .py file?

More information about the Mod_python mailing list