FAQ
Hi Kiran,

could you post the exact error entry from your error_log, please?

Cheers,
Eric


Am Montag, 03.11.03 um 06:18 Uhr schrieb Kiran Budhrani:
Hi eric, I havent solved my problem... do u have any suggestions?
what could possibly be wrong.. Im using Apache as my server and the
error appears in the error log.
?
pls help.. thanks! =)

Eric Wichterich wrote:

Hello Kiran,

just wanted to ask whether your problem is already solved (if found not
further postings to this thread).

Greetings,
Eric


<image.tiff>
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 756 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-list/attachments/20031103/05bd8d0d/attachment.bin

Search Discussions

  • Kiran Budhrani at Nov 3, 2003 at 1:32 pm
    hello eric,

    Im getting this error:
    [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()

    Eric Wichterich wrote:
    Hi Kiran,

    could you post the exact error entry from your error_log, please?

    Cheers,
    Eric


    Am Montag, 03.11.03 um 06:18 Uhr schrieb Kiran Budhrani:
    Hi eric, I havent solved my problem... do u have any suggestions?
    what could possibly be wrong.. Im using Apache as my server and the
    error appears in the error log.

    pls help.. thanks! =)

    Eric Wichterich wrote:

    Hello Kiran,

    just wanted to ask whether your problem is already solved (if found not
    further postings to this thread).

    Greetings,
    Eric



    ---------------------------------
    Do you Yahoo!?
    Exclusive Video Premiere - Britney Spears
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20031103/9abd80c7/attachment.htm
  • Eric Wichterich at Nov 3, 2003 at 1:55 pm
    Hello Kiran,

    hmmm. Ensure that MySQL-DB-accesses are allowed for python (maybe use
    PHPMyAdmin to administrate MySQL and select the appropriate options).
    You can set from which IPs MySQL-accesses are allowed (e. g.
    "localhost" if Python and MySQL are running on same computer) and which
    privileges are granted for this IP.

    Have you checked PYTHONPATH whether the right MySQLdb-module is
    imported (if you have more than one versions of python or mysqldb
    installed)?

    Hmmm. I think a password statement is missing in your code " connection
    = MySQLdb.connect( db = "try" ) "

    Here is an example of my statement which works fine:

    "db = MySQLdb.connect(host="localhost", db="mydatabase",
    user="thegreatestuser", passwd="mypassword")"

    Maybe this helps?

    Cheers,
    Eric

    Am Montag, 03.11.03 um 14:32 Uhr schrieb Kiran Budhrani:
    hello eric,
    Im getting this error:
    [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()

    Eric Wichterich wrote:

    Hi Kiran,

    could you post the exact error entry from your error_log, please?

    Cheers,
    Eric


    Am Montag, 03.11.03 um 06:18 Uhr schrieb Kiran Budhrani:
    Hi eric, I havent solved my problem... do u have any suggestions?
    what could possibly be wrong.. Im using Apache as my server and the
    error appears in the error log.
    ?
    pls help.. thanks! =)

    Eric Wichterich wrote:

    Hello Kiran,

    just wanted to ask whether your problem is already solved (if found not
    further postings to this thread).

    Greetings,
    Eric

    <image.tiff>
    Do you Yahoo!?
    Exclusive Video Premiere - Britney Spears
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: text/enriched
    Size: 3412 bytes
    Desc: not available
    Url : http://mail.python.org/pipermail/python-list/attachments/20031103/c29dc297/attachment.bin
  • Eric Wichterich at Nov 3, 2003 at 5:37 pm
    When I downloaded the MySQLdb module, i installed it in the?python
    directory. Im not sure if i should have installed it on apache instead.
    ?
    Im sorry but this is my first time to use python and im not really
    familiar with all the terminologies. Im not sure if the local host you
    mentioned is the same one as the one in control panel>Administrative
    tools>Data Sources.. this is where i connected the SQL driver and the
    database?called 'try' and the host is "127.0.0.1"-apache settings
    ?
    How do i check the PYTHONPATH? Im pretty sure i have only 1 python
    installed.
    ?
    I tried doing this too...
    "db = MySQLdb.connect(host="127.0.0.1", db="try")" - i dint put the
    username and password coz i did not set any.
    ?
    BUt it still wont work... same error...
    ?
    From all my checking and testing, im pretty sure the error occurs in
    the 'import MySQLdb' line. But i dont knw where else i could import it
    from...
    ?
    Thanks Eric!
    ~kiran~



    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: text/enriched
    Size: 938 bytes
    Desc: not available
    Url : http://mail.python.org/pipermail/python-list/attachments/20031103/a704583c/attachment.bin
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20031103/a704583c/attachment.html
    -------------- next part --------------


    Do you Yahoo!?
    Exclusive Video Premiere - Britney Spears
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: text/enriched
    Size: 127 bytes
    Desc: not available
    Url : http://mail.python.org/pipermail/python-list/attachments/20031103/a704583c/attachment-0001.bin
  • Eric Wichterich at Nov 3, 2003 at 5:50 pm
    Hi Kiran,

    about the PYTHONPATH:
    Simply write this small program or use a line-interpreter:
    "import sys
    print sys.path"

    In case you are using Windows, I am afraid, I can't offer any real
    help. I use Mac OS X, so I don't know how to examine this special
    problem.

    Maybe you could try reinstalling mysqldb and check if you did
    everything properly as mentioned in the install doc. Otherwise it could
    be a good idea to post again in this python-list-forum (e.g.: Subject:
    "Importing MySQLdb module causes malformed header error")

    Cheers,
    Eric


    Am Montag, 03.11.03 um 18:32 Uhr schrieb Kiran Budhrani:
    When I downloaded the MySQLdb module, i installed it in the?python
    directory. Im not sure if i should have installed it on apache > instead.
    ?
    Im sorry but this is my first time to use python and im not really
    familiar with all the terminologies. Im not sure if the local host you
    mentioned is the same one as the one in control panel>Administrative
    tools>Data Sources.. this is where i connected the SQL driver and the
    database?called 'try' and the host is "127.0.0.1"-apache settings
    ?
    How do i check the PYTHONPATH? Im pretty sure i have only 1 python
    installed.
    ?
    I tried doing this too...
    "db = MySQLdb.connect(host="127.0.0.1", db="try")" - i dint put the
    username and password coz i did not set any.
    ?
    BUt it still wont work... same error...
    ?
    From all my checking and testing, im pretty sure the error occurs in
    the 'import MySQLdb' line. But i dont knw where else i could import it
    from...
    ?
    Thanks Eric!
    ~kiran~


    <image.tiff>
    Do you Yahoo!?
    Exclusive Video Premiere - Britney Spears
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: text/enriched
    Size: 1728 bytes
    Desc: not available
    Url : http://mail.python.org/pipermail/python-list/attachments/20031103/1ab6b4c3/attachment.bin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedNov 3, '03 at 12:41p
activeNov 3, '03 at 5:50p
posts5
users2
websitepython.org

2 users in discussion

Eric Wichterich: 4 posts Kiran Budhrani: 1 post

People

Translate

site design / logo © 2022 Grokbase