another docs problem - imp

rurpy at rurpy at
Mon Jan 9 21:21:00 EST 2006

Another Python docs problem...

I was trying to use imp.find_module().

>>> imp.find_module("mymod", "./subdir")
ImportError: No frozen submodule named ./subdir.mymod

subdir/ definately exists, has reasonable
permissions, etc.

After a lot of reading and re-reading the docs,
trying various things, I Googled on the error
message and lo, there was a message from
2002 by someone ranting about how hard
it was to do things in Python sometimes (no it
was not from me).

Turns out that you have to do
>>> imp.find_module("mymod", ["./subdir"])

I saw not a hint of this in the docs.  In fact
they seem to say that the first (unworking)
form *should* work.  Bye bye about two
hours altogether...

I thought I would post this and hopefully help
someone else in the future (since I noticed
an unanswered posting here from Mar 2005
about the same problem.)

More information about the Python-list mailing list