location of home made modules
Felix Thibault
felixt at dicksonstreet.com
Mon May 15 22:50:59 EDT 2000
At 22:01 5/15/00 GMT, Huaiyu Zhu wrote:
>What is the standard place to put one's home-made modules?
>How to get Python to know that place? I tried to put modules in
>~/lib/python/ with the following in ~/.pythonrc
>
>import sys, os
>sys.path.append("%s/lib/python" % os.environ["HOME"])
>
>This works in the interactive interpreter but does not get the module from
>program files. Previously all my modules stay in the same directory as the
>programs that load them so this problem did not manifest itself.
>
>
>I can't find where in the docs this is mentioned.
>Thanks for any pointer.
>
>--
>Huaiyu Zhu hzhu at knowledgetrack.com
>--
>http://www.python.org/mailman/listinfo/python-list
>
I think this is to do with whatever shell you're using...with the bash shell
what I had to do so my scripts could find my modules was open up the
~/.bash_profile
file and add the line:
PYTHONPATH=$HOME/lib/python
to the section where the PATH variable was defined and then add
PYTHONPATH onto the list of variables after the 'export' statement at the
end of the file.
But I think it all depends on which shell you're using...
Hopefully helpfully-
Felix
More information about the Python-list
mailing list