Is there some Python function that searches "sys.path" for a module?

Miki miki.tebeka at gmail.com
Tue Jan 15 02:02:41 EST 2008


Hello John,

>    Python's own loader searches "sys.path" for module names, but is there
> some function that makes that search functionality accessible to
> Python programs?  I need the absolute pathname of a module, with the
> search being done exactly the same way "import" does it.  The loader for
> "egg" files has this functionality, but I'd like to find out if there's
> a standard way to do this before looking into that source code.
>
>    Also, it seems that the environment variable "PYTHONPATH" applies to
> "import", but not to the starting module named on the Python command
> line.  Is that correct?  Thanks.
http://docs.python.org/lib/module-imp.html

HTH,
--
Miki Tebeka <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com



More information about the Python-list mailing list