Is there some Python function that searches "sys.path" for a module?
Shane Geiger
sgeiger at ncee.net
Tue Jan 15 02:14:18 EST 2008
If I understand you correctly, you want this:
module.__file__
John Nagle wrote:
> 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
>
--
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net | 402-438-8958 | http://www.ncee.net
Leading the Campaign for Economic and Financial Literacy
More information about the Python-list
mailing list