[Tutor] Why this error ?

Mário Gamito gamito at gmail.com
Thu Feb 1 00:05:28 CET 2007


Hi,

I have this code:

import MySQLdb

    conn = MySQLdb.connect (host = "localhost", user = "testuser", 
passwd = "testpass", db = "test")
    cursor = conn.cursor ()
    cursor.execute ("SELECT VERSION()")
    row = cursor.fetchone ()
    print "server version:", row[0]
    cursor.close ()
    conn.close ()

that gives me the error:
"./mysql.py: line 3: syntax error near unexpected token `('
./mysql.py: line 3: `   conn = MySQLdb.connect (host = "localhost", user 
= "testuser", passwd = "testpass", db = "test")'
"

Why is this ?
I can't imagine.

Any help would be appreciated.

Warm Regards,
Mário Gamito


More information about the Tutor mailing list