FAQ
Thank you, Martin,

I fixed the problem with pythonpath and figured out that there is a
problem with Apache and CGI, not with importing the library anymore.
There is something Apache doesn't like. I only get the two different
errors: Malformed header - or - premature end of file, no further
details. The python-scripts work fine on a linux server with Apache in
contrast to Apache on Mac OS X...

I'll keep working on it. It's just frustrating.

Eric

Von: Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>
Datum: Fr, 24. Okt 2003 11:47:01 Europe/Berlin
An: Python List <python-list at python.org>
Betreff: Re: How to set pythonpath in Mac OS X?

On Fri, 2003-10-24 at 10:20, 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".
Is this a typo you do not need the .py on the end
it should (perhaps) read:

from library import function

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?
The pythonpath (or PYTHONPATH) variable is an environment variable -
I'm no MAC expert but I expect there is a command you could use to show
it's value... however from inside a running python program the
PYTHONPATH variable is stored in sys.path and is a list of paths that
python will look in for your module / package.

Python 2.3 (#1, Aug 27 2003, 10:53:10)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sys
sys.path
['', '/usr/local/lib/python23.zip', '/usr/local/lib/python2.3',
'/usr/local/lib/python2.3/plat-linux2',
'/usr/local/lib/python2.3/lib-tk',
'/usr/local/lib/python2.3/lib-dynload',
'/usr/local/lib/python2.3/site-packages',
'/usr/local/lib/python2.3/site-packages/PIL']

A quick google on PYTHONPATH should point you towards some useful
information... it is also explained in the (free, online) python
tutorial
http://www.python.org/doc/current/tut/
node8.html#SECTION008110000000000000000
It would be great if anyone could help me out on this?

Thanks,
Eric

Regards
Martin


--
Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 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