mysqldb bytes error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mysqldb (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
The version of the library provided in the distribution contains an error.
TypeError: a bytes-like object is required, not 'str'
This bug is fixed in the library version 1.3.13 or can be fixed by a patch:
--- MySQLdb/
+++ MySQLdb/cursors.py
@@ -21,7 +21,17 @@
else:
text_type = str
-
+def convert_
+ if isinstance(
+ return tuple(convert_
+ if isinstance(
+ return ([convert_
+ elif isinstance(
+ return {convert_
+ elif isinstance(
+ return var.decode('utf-8')
+ else:
+ return var
#: Regular expression for :meth:`
#: executemany only supports simple bulk insert.
#: You can use it to load large dataset.
@@ -443,6 +453,9 @@
else:
result = self._rows
+ if not PY2:
+ db = self._get_db()
+ result = tuple(convert_
return result
def scroll(self, value, mode='relative'):
Please upgrade version lib or apply this patch.
Status changed to 'Confirmed' because the bug affects multiple users.