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

John Nagle nagle at animats.com
Tue Jan 15 01:53:36 EST 2008


   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.

				John Nagle



More information about the Python-list mailing list