[mythtv-commits] Ticket #13123: Exception using python bindings
MythTV
noreply at mythtv.org
Sun Sep 17 09:19:47 UTC 2017
#13123: Exception using python bindings
-----------------------------------+--------------------------
Reporter: tom@… | Owner: wagnerrp
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: Bindings - Python | Version: 0.28.1
Severity: medium | Keywords:
Ticket locked: 0 |
-----------------------------------+--------------------------
With recent versions of the python MySQLdb library you can get an
exception when the MythTV python bindings do executemany:
{{{
Traceback (most recent call last):
File "./mythcommflag-silence", line 250, in <module>
main()
File "./mythcommflag-silence", line 217, in main
rec.update()
File "/usr/lib/python2.7/site-packages/MythTV/database.py", line 429, in
update
self._push()
File "/usr/lib/python2.7/site-packages/MythTV/dataheap.py", line 354, in
_push
self.markup.commit()
File "/usr/lib/python2.7/site-packages/MythTV/database.py", line 624, in
commit
','.join(['?' for a in fields])), data)
File "/usr/lib/python2.7/site-packages/MythTV/_conn_mysqldb.py", line
96, in executemany
raise MythDBError(MythDBError.DB_RAW, e.args)
MythTV.exceptions.MythDBError: MySQL error: sequence item 0: expected
string, bytearray found
}}}
The problem is that executemany calls back to the logged cursor with the
query expressed as a bytearray that has been encoded using the database
encoding. That then throws an exception because you can't use join on a
bytearray.
I have opened https://github.com/MythTV/mythtv/pull/153 with a patch to
decode back to a string in this case.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13123>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list