I'm having trouble with MySQL-python being unable to handle string rows. Whenever a command attempts to execute and returns a string value in a column, it throws a ValueError exception: "invalid literal for float()" (ie, it looks like it's trying to turn everything into a float).
import MySQLdb
conn = MySQLdb.connect(db="database", user="user")
c = conn.cursor()
c.execute("SELECT * FROM table")
Traceback (most recent call last):
File "test.py", line 9, in ?
c.execute("SELECT * FROM table")
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 95, in execute
return self._execute(query, args)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 114, in _execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler
raise errorclass, errorvalue
ValueError: invalid literal for float(): A String
Using the debugger, the actual source of the exception is in _fetch_row(), line 201, in cursors.py: return self._result.fetch_row(size, self._fetch_type) is throwing it. Size and self._fetch_type are both 0 when it's called.
I'm using Python 2.2.2, MySQL 4.0.12, and MySQL-python 0.9.2
Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm having trouble with MySQL-python being unable to handle string rows. Whenever a command attempts to execute and returns a string value in a column, it throws a ValueError exception: "invalid literal for float()" (ie, it looks like it's trying to turn everything into a float).
import MySQLdb
conn = MySQLdb.connect(db="database", user="user")
c = conn.cursor()
c.execute("SELECT * FROM table")
Traceback (most recent call last):
File "test.py", line 9, in ?
c.execute("SELECT * FROM table")
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 95, in execute
return self._execute(query, args)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/cursors.py", line 114, in _execute
self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.2/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler
raise errorclass, errorvalue
ValueError: invalid literal for float(): A String
Using the debugger, the actual source of the exception is in _fetch_row(), line 201, in cursors.py: return self._result.fetch_row(size, self._fetch_type) is throwing it. Size and self._fetch_type are both 0 when it's called.
I'm using Python 2.2.2, MySQL 4.0.12, and MySQL-python 0.9.2
Any ideas?
I'm seeing this same thing. Was there any resolution on this problem?