[Tutor] Why this error ?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Feb 1 00:37:11 CET 2007


>> 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.


It's supposed to be without quotes on the keyword argument names.

     conn = MySQLdb.connect (host = "localhost",
                             user = "testuser",
                             passwd = "testpass",
                             db = "test")

It is very good that you're showing us literal error messages.  There is 
something very funky looking in the error message you're showing us:

     "./mysql.py: line 3: syntax error near unexpected token `(

That does NOT look like a Python error message.  It looks like a shell 
error message from bash.  Double check that you're running the script with 
Python.


More information about the Tutor mailing list