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

Discussion in 'Python' started by Kiran B., Nov 5, 2003.

  1. Kiran B.

    Kiran B. Guest

    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!!
     
    Kiran B., Nov 5, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kiran B.

    Malformed header error... pls help!

    Kiran B., Nov 2, 2003, in forum: Python
    Replies:
    1
    Views:
    540
    Derrick 'dman' Hudson
    Nov 6, 2003
  2. Eric Wichterich

    Fwd: Malformed Header

    Eric Wichterich, Nov 3, 2003, in forum: Python
    Replies:
    0
    Views:
    418
    Eric Wichterich
    Nov 3, 2003
  3. Raaijmakers, Vincent (IndSys,GE Interlogix)

    RE: Importing MySQLdb module causes malformed header error.. plshelp!!!

    Raaijmakers, Vincent (IndSys,GE Interlogix), Nov 5, 2003, in forum: Python
    Replies:
    1
    Views:
    551
    Kiran B.
    Nov 6, 2003
  4. plb
    Replies:
    2
    Views:
    547
  5. mlt
    Replies:
    2
    Views:
    1,153
    Jean-Marc Bourguet
    Jan 31, 2009
  6. labbit
    Replies:
    1
    Views:
    1,149
    urstop
    Oct 28, 2009
  7. David George

    Error Importing MySQLdb

    David George, Jan 8, 2012, in forum: Python
    Replies:
    6
    Views:
    967
    John Nagle
    Jan 9, 2012
  8. Douglas Livingstone

    Apache -> malformed header from script

    Douglas Livingstone, Jan 28, 2005, in forum: Ruby
    Replies:
    4
    Views:
    4,111
    Aredridel
    Jan 29, 2005
Loading...