[mod_python] More on import errors in 2.7.5

Tom Emerson tree at basistech.com
Thu Jul 19 09:16:14 EST 2001


A couple of days ago I posted a question about strange import
behaviors with 2.7.5,

<http://www.modpython.org/pipermail/mod_python/2001-July/001519.html>

I haven't heard from anyone with a solution, though scanning the
archives it appears that this has been an issue for a while for some
people. So I started digging.

The short: the problem is still there.

The long:

- I reverted to 2.7.2 and the problem is still there. <sigh>

- I added some log_error() calls in various places in both publisher.py
  and apache.py to verify the state of the world upto the point
  apache.py attempts to reload the module. As far as I can tell,
  everything is valid up to the point of the reload call: sys.modules
  includes an entry for the module I'm reloading, the pathnames to the
  module are correct, everything looks fine, but reload() is throwing
  an ImportError.

  I observed that this problem usually happens in the following
  scenario:

  1) The module is loaded successfully.
  2) You make a modification to the module source which causes
     mod_python to reload the module. This works fine.
  3) You make another modification to the module that will cause an
     error when the module is being parsed when it is reloaded.
  4) You fix the error and reload.
  5) Bam, ImportError.

  Could it be the case that the module is partially initialized and
  isn't really reloadable?

Also, FWIW, the server doesn't have write access to the directory
containing these modules, so the .pyc files are not being created.

Food for thought.

    -tree

-- 
Tom Emerson                                          Basis Technology Corp.
Sr. Sinostringologist                              http://www.basistech.com
  "Beware the lollipop of mediocrity: lick it once and you suck forever"



More information about the Mod_python mailing list