[mythtv-users] mythvidexport.py failing on one episode -- still the non-ascii bug?

Stephen Worthington stephen_agent at jsw.gen.nz
Fri May 18 01:50:21 UTC 2018


On Thu, 17 May 2018 15:10:57 -0400, you wrote:

>On Thu, May 17, 2018 at 2:45 PM, Jim <lists at morton.hrcoxmail.com> wrote:
>
>> On 5/17/2018 1:25 PM, Ian Evans wrote:
>>
>>> On Wed, May 16, 2018 at 5:21 PM, Ian Evans <dheianevans at gmail.com
>>> <mailto:dheianevans at gmail.com>> wrote:
>>>
>>>     On Wed, May 16, 2018 at 4:46 PM, Nicolas Krzywinski
>>>     <myth2 at site7even.de <mailto:myth2 at site7even.de>> wrote:
>>>
>>>         Am 15.05.2018 um 23:47 schrieb Ian Evans:
>>>
>>>>
>>>>         UnicodeEncodeError: 'ascii' codec can't encode character
>>>>         u'\xf1' in position 105: ordinal not in range(128)
>>>>         2018-05-15 17:40:41.217882 D [23968] Python Database
>>>>         Connection database callback received -- 0x7f4c75b3e628
>>>>         2018-05-15 17:40:41.218213 D [23968] Python Database
>>>>         Connection Releasing connection to pool
>>>>
>>>>         Looking at github I see the script hasn't been updated in a
>>>>         few years. It's a great script but I don't know python.
>>>>         Anyway to patch it or should I just shrug and temporarily
>>>>         change the "Piñata" to "Pinata" and change it back after the
>>>>         export?
>>>>
>>>>         Thanks.
>>>>
>>>         Did you tried setting utf8 charset like this?
>>>
>>>         PYTHONIOENCODING=utf-8 python /srv/bin/mythvidexport.py
>>>         --skiplist --listingonly --delete %JOBID%
>>>
>>>
>>>
>>>     Took your suggestion and added PYTHONIOENCODING=utf-8 to the start
>>>     of the command line. Got the same result at the end of the logging:
>>>
>>>     "UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1'
>>>     i"n position 105: ordinal not in range(128)"
>>>
>>>
>>> A question about the error line about the ascii codec: is it being thrown
>>> by is the error in line 428 of /usr/lib/python2.7/dist-packages/MythTV/logging.py
>>> which is:
>>>
>>> message + (' -- {0}'.format(detail) if detail else '')))
>>>
>>> Assuming you meant 128 and not 428...
>> 105 is the position of the character at issue. 128 is the range of ASCII
>> characters (0-127) that the accented character is outside of.
>>
>> --
>> Jim
>>
>>
>>
>No, I DID mean line 428 of logging.py as seen in the trace. Just curious is
>that's the line that's causing the character in position 105 to trigger the
>error. Forgot to include the line in my last message:
>
>
>File "/usr/lib/python2.7/dist-packages/MythTV/logging.py", line 428, in
>_logdatabase
>    message + (' -- {0}'.format(detail) if detail else '')))
>UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
>position 105: ordinal not in range(128)

Yest, that is the line where the error is happening, in the MythTV
Python bindings logging system.  It looks as though, for some strange
reason, the string is being converted to ASCII.  In Python these days,
as much as possible all strings should be being stored and used as
Unicode.  And up until that line, they seem to have been Unicode.  I
have not delved into the logging.py file for quite a while, but the
problem likely lies in there somewhere.  I can not see any reason why
the logging output would want to be in ASCII - doing the output in
Unicode is what you would normally want.  But something is forcing a
conversion.


More information about the mythtv-users mailing list