[mythtv-commits] Ticket #13502: Support python-PyMySQL as alternative MySQL connector for python bindings
MythTV
noreply at mythtv.org
Sun Dec 8 10:52:27 UTC 2019
#13502: Support python-PyMySQL as alternative MySQL connector for python bindings
-------------------------------+-----------------------------
Reporter: Gary Buhrmaster | Owner: Bill Meek
Type: Patch - Feature | Status: accepted
Priority: minor | Milestone: 31.0
Component: Bindings - Python | Version: Master Head
Severity: medium | Resolution:
Keywords: | Ticket locked: 0
-------------------------------+-----------------------------
Comment (by rcrdnalor):
Looking at the MythTV wiki, the proposed call to get a 'Recorded'
instance through the python bindings is
{{{
rec = Recorded((chanid,starttime), db = MythDB())
}}}
I have proplems running my test cases against PyMySQL
as proposed by the attached patch :
Latest installed via pip3:
https://pypi.org/project/PyMySQL/
{{{
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
>>> pymysql.__version__
'0.9.3'
}}}
Running a simple code as recommended in MythTV wiki with the patch
applied:
{{{
$ python
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from MythTV import MythDB, Recorded
>>> db = MythDB()
>>> rec = Recorded((3030, 20190305135100),db=db)
Traceback (most recent call last):
......
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/local-admin/MythTV/MythTV_python/MythTV/dataheap.py", line
344, in __init__
DBDataWrite.__init__(self, data, db)
File "/home/local-admin/MythTV/MythTV_python/MythTV/database.py", line
318, in __init__
DBData.__init__(self, data, db)
File "/home/local-admin/MythTV/MythTV_python/MythTV/database.py", line
180, in __init__
self._pull()
File "/home/local-admin/MythTV/MythTV_python/MythTV/database.py", line
388, in _pull
DBData._pull(self)
File "/home/local-admin/MythTV/MythTV_python/MythTV/database.py", line
201, in _pull
% (self._table, self._where), self._getwheredat())
File "/home/local-admin/MythTV/MythTV_python/MythTV/_conn_mysqldb.py",
line 90, in execute
raise MythDBError(MythDBError.DB_RAW, e.args)
AttributeError: 'datetime' object has no attribute 'translate'
}}}
Running the same code as mentioned above
with python3-mysqldb ( source from https://pypi.org/project/mysqlclient/ )
gives the following result as expected:
{{{
$ python
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from MythTV import MythDB, Recorded
>>> db = MythDB()
>>> rec = Recorded((3030, 20190305135100),db=db)
>>> rec
<Recorded 'Die Lady von Shanghai','2019-03-05 13:51:00+01:00' at
0x7fa7b93b44d0>
>>>
}}}
Conclusion:
The patch from this ticket prefers PyMySQL over MySQLDB.
Expect major troubles from users of the MythTV python bindings once this
patch gets applied.
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13502#comment:5>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list