[mod_python] mod_python.publisher weirdness

Kamil Niechajewicz kamil at nvstudio.pl
Wed Apr 14 14:14:38 EST 2004


> and btw. i often get this error, don't know why this happens, unreferenced
> variable is very common error and should be handled somehow because there
> is high possibility that it will occur somewhere:
> 
>   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 481, in import_module
>     if mtime > oldmtime:
> 
> UnboundLocalError: local variable 'oldmtime' referenced before assignment

I guess I found what causes this problem, in apache.py:

   if not file or (path and not filter(file.startswith, path)):
       # there is a script by this name already imported, but it's in
       # a different directory, therefore it's a different script
       mtime, oldtime = 0, -1
                ^
                |_ should be oldmtime, right?

I'm going to run through this file and find importing mechanism, maybe
there is a solution for importing wrong modules of the same name.. Someone
once wrote here that it's the matter of using 'startswith' that matches
both directories, and picking wrong module because of that..

/Kamil


More information about the Mod_python mailing list