another docs problem - imp

rurpy at yahoo.com rurpy at yahoo.com
Wed Jan 11 06:37:18 CET 2006


"Fredrik Lundh" <fredrik at pythonware.com> wrote:
> 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)".

Well, I interpreted the if's as describing special cases
addtional to the first sentence.  At least one other person
apperantly had the same problem recently.
http://groups.google.com/group/comp.lang.python/msg/3c052b05157d0546?hl=en&
May I suggest that the problem is easily fixed simply
by removing the first "if".




More information about the Python-list mailing list