[Tutor] Why this error ?
gamito at gmail.com
Thu Feb 1 00:23:49 CET 2007
Asrarahmed Kadri wrote:
> could you try:
> I mean put all the parameters with quotes, I guess that might be a cause
> of the error.
> conn = MySQLdb.connect ('host' = "localhost", 'user' = "testuser",
> 'passwd'= "testpass", 'db' = "test")
No, unfortunately the problem remains, but thanks anyway.
> On 1/31/07, *Mário Gamito* <gamito at gmail.com <mailto:gamito at gmail.com>>
> 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
> 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",
> = "testuser", passwd = "testpass", db = "test")'
> Why is this ?
> I can't imagine.
> Any help would be appreciated.
> Warm Regards,
> Mário Gamito
> Tutor maillist - Tutor at python.org <mailto:Tutor at python.org>
> To HIM you shall return.
More information about the Tutor