FAQ
In article <mailman.69.1066987239.702.python-list at python.org>,
Eric Wichterich wrote:
Hello Pythonistas,

I am trying to get certain (self-written) libraries imported into my
scripts using statements like

"from library import function.py".

But they are not being found.

I think that the pythonpath-variable must be expanded to the location
to this libraries.

But, I can't find any usable information using Google on how to set up
the pythonpath properly.
I don't even know where to look for the pythonpath-variable?

It would be great if anyone could help me out on this?
You can define the environment variable PYTHONPATH to include any paths
you like, and python will read this info when it starts up.

On MacOS X you have several choices for defining environment variables.
All work for unix command-line apps, but only can be seen by GUI apps,
so it's the one I recommend you use: put the information into a file
.MacOSX/environment.plist (which you will probably have to create).
Instructions are available at
<http://www.astro.washington.edu/owen/AquaEnvVar.html>

If you only care about command-line usage then you can edit ~/.cshrc and
include a command such as
setenv PYTHONPATH "/path/one/:path/two:..."
(note: .cshrc may not be the best choice, but it certainly works).

Warning: do NOT mix these two techniques. At least in Jaguar,
environment.plist completely overrides env variables defined or modified
in .cshrc.

-- Russell

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedOct 24, '03 at 9:20a
activeOct 24, '03 at 9:46p
posts5
users4
websitepython.org

People

Translate

site design / logo © 2022 Grokbase