[mod_python] import madness!

Gregory (Grisha) Trubetskoy grisha at modpython.org
Tue May 11 21:35:58 EST 2004


On Tue, 11 May 2004, The Doctor What wrote:

> I have found an interesting bug.  My handler has, at it's start,
> something like:
> from blah import config
>
> This is great, works fine, etc. EXCEPT when I clean up the .pyc
> files in the blah directory!  Then it says that it cannot import
> config!
>
> Looking at sys.modules, I see that sys.modules[blah.config] is set
> to <module 'blah' from 'path-to/blah/config.pyc'>. It is
> easily reproducable.  A lame work around is to make the path-to/blah
> directory group read-only so that .pyc files cannot be created.

I am not sure I understand - by "clean up" you mean delete the .pyc files
- but at which point do you get the "cannot import config" error?

Grisha




More information about the Mod_python mailing list