2023-08-16, 16:05
I am writing a video addon and to parse the EPG I need to convert from the API provided date format to the EPG compatible version. Upon writing the code that handles this logic for me, I encountered a strange issue:
If I run this, I get:
Other dates work fine... And if I run the same thing from my regular bash shell's python 3.11.3 installation, I get the expected result:
Can you reproduce as well? Any possible workarounds?
I am running Kodi v20.2 on an Arch laptop.
Thanks
Code:
import sys
from datetime import datetime
sys.stderr.write(datetime.strptime("14/08/2023 21:45:00", "%d/%m/%Y %H:%M:%S").strftime("%Y%m%d%H%M%S %z"))
If I run this, I get:
Code:
2023-08-16 15:58:49.543 T:38735 error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'TypeError'>
Error Contents: 'NoneType' object is not callable
Traceback (most recent call last):
File "/home/steve/.kodi/addons/plugin.video.test/default.py", line 781, in <module>
update_epg(session)
File "/home/steve/.kodi/addons/plugin.video.test/default.py", line 715, in update_epg
sys.stderr.write(datetime.strptime("14/08/2023 21:45:00", "%d/%m/%Y %H:%M:%S").strftime("%Y%m%d%H%M%S %z"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable
-->End of Python script error report<--
Other dates work fine... And if I run the same thing from my regular bash shell's python 3.11.3 installation, I get the expected result:
Code:
>>> a = '14/08/2023 21:45:00'
>>> datetime.strptime(a, "%d/%m/%Y %H:%M:%S").strftime("%Y%m%d%H%M%S %z")
'20230814214500 '
Can you reproduce as well? Any possible workarounds?
I am running Kodi v20.2 on an Arch laptop.
Thanks