How to debug this import problem?

Iwan iwan at reahl.org
Sat May 9 04:02:08 EDT 2009


Hi Scott, Diez,

On May 8, 8:21 pm, Scott David Daniels <Scott.Dani... at Acm.Org> wrote:
> Diez B. Roggisch wrote:
> > Try putting an "import pdb; pdb.set_trace()" on top of the decimal module.
[snip]
> You can also run Python with the "-v" or "-vv" flags to get output
> about exactly what files are getting imported from the file
> system and when.  "-v" iswhat it got, "-vv" is everywhere it tries.

Thanks, yes we did do the pdb.set_trace(), but everything looked fine
(ie, the paths used to import each module from was the same each time)
in there except for the fact that id(sys) and id(decimal) were
different each time decimal got imported.  Python -vv also reveals
that the paths used to import the modules from are always the same
paths and correct.

However, on the stack trace, there is another strangeness:

We have a little script that loads the tests that have to be run.
This loading happens 3 times, and the module is imported 3 times -
each time as a result of loading tests. This happens with the
following line:

module = __import__(moduleName, globals(), locals(), [className])

I was wondering whether this could have something to do with it?

Regards
- Iwan



More information about the Python-list mailing list