Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Importing MySQLdb module causes malformed header error.. pls help!!!

Reply
Thread Tools

Importing MySQLdb module causes malformed header error.. pls help!!!

 
 
Kiran B.
Guest
Posts: n/a
 
      11-05-2003
Hello, im having this error while using Apache and the MySQLdb module.
[error] [client 127.0.0.1] malformed header from script. Bad
header=*** You don't have the (right): c:/program files/apache
group/apache/cgi-bin/fig28_18.py

I have connected all databases already. If I remove the import MySQL
statement, theres no problem. But i need to use the database. . what
could possibly be wrong???

pls help.. I have the MySQLdb installed in my Python directory
already..


#!c:\Python23\python.exe

import cgi
import MySQLdb


def printContent():
print "Content-type: text/html\n\n"
print
print """
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en">
<head><title>Registration results</title></head>


def printReply():
from convert import genPrime, genPrimeE
p1 = genPrime()
q1 = genPrime()
e1 = genPrimeE()
N1 = p1 * q1
M1 = (p1-1)*(q1-1)
print 'e1 %d, m1 %d' %(e1,M1)

while(e1 % M1 == 0):
e1 = genPrimeE()

connection = MySQLdb.connect( db = "try" )

cursor = connection.cursor()
cursor.execute("insert into trials (p,q,n,m) values
('p1','q1','n1','m1');")
authorList = cursor.fetchall()
cursor.close() # close cursor
connection.close()


printContent()
form = cgi.FieldStorage()

personInfo = { 'firstName' : form[ "firstname" ].value,
'lastName' : form[ "lastname" ].value,
'email' : form[ "email" ].value,
'phone' : form[ "phone" ].value,
'book' : form[ "book" ].value,
'os' : form[ "os" ].value,
'message' : form["message"].value }
printReply()


thanks!!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to keep a module with the same name as a module it is importing from importing itself? plb Python 2 02-08-2005 03:14 PM
Malformed header error... pls help! Kiran B. Python 1 11-06-2003 06:14 PM
RE: Importing MySQLdb module causes malformed header error.. plshelp!!! Raaijmakers, Vincent (IndSys,GE Interlogix) Python 1 11-06-2003 01:52 AM
Re: Malformed Header Eric Wichterich Python 0 11-03-2003 01:55 PM
Re: Malformed Header Kiran Budhrani Python 0 11-03-2003 01:32 PM



Advertisments