[Tutor] Why this error ?

John Fouhy john at fouhy.net
Thu Feb 1 00:37:17 CET 2007


On 01/02/07, Mário Gamito <gamito at gmail.com> wrote:
> Ok, now i have:
>
> 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 ()
>
> but the problem remains :-(

This will fail because you have quote marks around 'host', 'user',
etc.  See the tutorial on keyword arguments..

-- 
John.


More information about the Tutor mailing list