Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

another docs problem - imp


  • From: fredrik at pythonware.com (Fredrik Lundh)
  • Subject: another docs problem - imp
  • Date: Tue, 10 Jan 2006 06:49:43 +0100

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>