[Pythonmac-SIG] How to import libraries on Mac OS X?

Eric Wichterich eric at wichterich.net
Thu Oct 23 16:08:36 EDT 2003

Hello Sarwat,

the entry of the error_log is:
[Thu Oct 23 21:54:46 2003] [error] [client 123.456.654.321] malformed 
header from script. Bad header=  from name_of_library impo: 

The files were set to chmod "755".


Am Donnerstag, 23.10.03 um 19:57 Uhr schrieb Sarwat Khan:

> You should check /var/log/httpd/error_log for a description of the 
> error.
> What's likely to be happening is that when you try to import your 
> library, Python writes an error to out, and Apache sees this instead 
> of the standard HTTP header text that's supposed to be printed. So 
> Apache prints the malformed header stuff.
> You might want to make sure that the files in cgi-bin are world 
> readable, and that cgi-bin are world-executable (searchable).
> On Thursday, October 23, 2003, at 05:07  AM, Eric Wichterich wrote:
>> Hello Pythonistas,
>> I've written a Python library with some functions I want to use with 
>> other Python scripts.
>> The library is located at (Mac OS X):
>> /Users/username/Sites/projectname/cgi-bin/name_of_library.py
>> (My scripts are located in this directory, too.)
>> I use the statement:  "from name_of_library import special_function" 
>> to import this special_function.
>> When I launch the Apache-Server and call a script which wants to 
>> import this library, I get a "malformed header" error.
>> But importing standard libraries, such as "from string import *", no 
>> error occurs.
>> Maybe some environment variables must be set. But which? Any ideas?
>> Thank you,
>> Eric
>> _______________________________________________
>> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
>> http://mail.python.org/mailman/listinfo/pythonmac-sig
> {sarwat khan : http://sarwat.net}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1858 bytes
Desc: not available
Url : http://mail.python.org/pipermail/pythonmac-sig/attachments/20031023/a4939e2f/attachment.bin

More information about the Pythonmac-SIG mailing list