another docs problem - imp

Fredrik Lundh fredrik at pythonware.com
Tue Jan 10 00:49:43 EST 2006


rurpy at yahoo.com wrote:

> 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.

from the find_module documentation:

          find_module( name[, path])


    Try to find the module _name_ on the search path _path_.
    If _path_ is a list of directory names, each directory is
    searched for files /.../. Invalid names in the list are
    silently ignored (but all list items must be strings).
    If _path_ is omitted or None, the list of directory names
    given by _sys.path_ is searched /.../

it's not obvious how anyone can interpret the alternatives "a
list where all items are strings / omitted / None" as "not a hint
that a list is expected" and "a single string *should* work (i.e.
be treated as a pathname, rather than a sequence)".

</F>






More information about the Python-list mailing list