Other than outdenting the whole thing, are you using a 'non-standard' 
character set? Are you sure that '(' isn't an alternative encoding 
variant that python isn't recognising as a parenthesis? I've see nthat 
sometimes with Japanese or unicode encoding.
Just a thought...
(Just to check, I tried your code in ERIC and it ran fine for me once 
the indenting was fixed up)

> 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")'
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to