[Pythonmac-SIG] How to import libraries on Mac OS X?
Eric Wichterich
eric.wichterich at gmx.de
Mon Oct 27 09:44:10 EST 2003
Hello Brian,
thank you for your hint. Printing sys.path gives:
['/Users/username/Sites/projectname/cgi-bin',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python23.zip',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-
darwin',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-
mac',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/plat-
mac/lib-scriptpackages',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-
tk',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/lib-
dynload',
'/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-
packages']
Eric
Am Freitag, 24.10.03 um 19:56 Uhr schrieb Brian Lenihan:
>
> On Oct 24, 2003, at 8:34 AM, Eric Wichterich wrote:
>
>> Thank you Ronald,
>>
>> I 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. These scripts work fine on a linux server with
>> Apache...
>
> You may be running into a situation which causes the wrong python libs
> to get loaded. You can test this by writing a simple cgi that imports
> sys and prints sys.path. On OS X, the full path to the executable in
> #! is not available to sys.argv which causes a lot of grief when
> python loads whatever if finds first in your PATH like /usr/bin
> instead of /usr/local/bin.
>
> The solution is to add a SetEnv directive for PYTHONPATH with the
> correct paths.
>
More information about the Pythonmac-SIG
mailing list