[Tutor] python by cgi

nik my.mailing.lists at noos.fr
Thu Sep 30 16:20:41 CEST 2004


A reply in four minutes flat - not bad going! :-)

There's not a lot to go on - Apache gives the error 500 internal server 
error. The server error log then gives;

[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] Traceback (most 
recent call last):
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1]   File 
"/usr/local/apache2/cgi-bin/testpyscript", line 3, in ?
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1]
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] import kinterbasdb
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] ImportError
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] :
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] No module named 
kinterbasdb
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1]
[Thu Sep 30 16:13:14 2004] [error] [client 127.0.0.1] Premature end of 
script headers: testpyscript

I've just tried adding
SetEnv PYTHONPATH /usr/lib/python2.3/site-packages/kinterbasdb
to the httpd.conf file of apache, which makes it appear in the sys.path 
ok, but it still can't load the kinterbasdb module.

nik

Chad Crabtree wrote:

>Could you give us your error message.  This sounds like a problem I
>had, 
>make sure that the filename is not colliding with any of the packages
>
>file names.
>
>nik wrote:
>
>  
>
>>hi all,
>>
>>I'm trying to access my firebird database using python and cgi.
>>    
>>
>I've 
>  
>
>>installed the latest apache web server (on linux), and using a
>>    
>>
>simple 
>  
>
>>script like;
>>#!/usr/local/bin/python
>>
>>def main():
>>   print "Content-type: text/html"
>>   print
>>   print "<TITLE> Hello, World!</TITLE>"
>>
>>if (__name__ == "__main__"):
>>   main()
>>
>>is working just fine.
>>
>>However, if I add an import kinterbasdb at the start, I get an
>>    
>>
>import 
>  
>
>>error.
>>
>>Using the command line interpreter I don't have a problem though.
>>
>>I'm a bit confused by the sys.path a bit, it seems to vary
>>    
>>
>depending 
>  
>
>>on how I start python;
>>
>>in command line iterpreter, it's;
>>'', '/usr/lib/python23.zip', '/usr/lib/python2.3', 
>>'/usr/lib/python2.3/plat-linux2', '/usr/lib/python2.3/lib-tk', 
>>'/usr/lib/python2.3/lib-dynload',
>>    
>>
>'/usr/lib/python2.3/site-packages', 
>  
>
>>'/usr/lib/python2.3/site-packages/Numeric', 
>>'/usr/lib/python2.3/site-packages/gtk-2.0'
>>
>>by cgi it's;
>>'/usr/local/apache2/cgi-bin', '/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'
>>
>>however, the difference doesn't seem to imply why kinterbasdb can't
>>    
>>
>be 
>  
>
>>imported.
>>
>>I tried doing
>>import sys
>>sys.path.append('/usr/lib/python2.3/site-packages/kinterbasdb')
>>
>>    
>>
>
>
>
>		
>__________________________________
>Do you Yahoo!?
>New and Improved Yahoo! Mail - Send 10MB messages!
>http://promotions.yahoo.com/new_mail 
>
>
>  
>



More information about the Tutor mailing list