Malformed header error... pls help!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kiran B.

    Malformed header error... pls help!

    hello,
    Im getting this error everytime i load this page.
    [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\p ython.exe

    import cgi
    import MySQLdb


    def printContent():
    print "Content-type: text/plain\n\n"
    print
    print """
    <html xmlns = "http://www.w3.org/1999/xhtml" xml:lang="en"
    lang="en">
    <head><title>Re gistration 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.curs or()
    cursor.execute( "insert into trials (p,q,n,m) values
    ('p1','q1','n1' ,'m1');")
    authorList = cursor.fetchall ()
    cursor.close() # close cursor
    connection.clos e()


    printContent()
    form = cgi.FieldStorag e()

    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()
  • Derrick 'dman' Hudson

    #2
    Re: Malformed header error... pls help!

    Kiran B. <kiranb_102@yah oo.com> wrote:[color=blue]
    > hello,
    > Im getting this error everytime i load this page.
    > [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???[/color]

    My guess ... you have something wrong with the MySQL installation.
    Probably the import statement throws an exception, which your other
    software reads as a malformed header (which it is). You need to get
    the actual error message (ie the contents of that header, or run the
    script differently to see the exception) and then solve the problem
    that it reports.

    -D

    --
    "Don't use C; In my opinion, C is a library programming language
    not an app programming language." - Owen Taylor (GTK+ developer)

    www: http://dman13.dyndns.org/~dman/ jabber: dman@dman13.dyn dns.org

    Comment

    Working...