Bug 465144 - Add explicit encoding to python's fileopen
Summary: Add explicit encoding to python's fileopen
Status: RESOLVED FIXED
Alias: None
Product: kid3
Classification: Applications
Component: general (other bugs)
Version First Reported In: 3.9.x
Platform: NetBSD pkgsrc NetBSD
: NOR major
Target Milestone: ---
Assignee: Urs Fleisch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-01 20:12 UTC by Thomas Klausner
Modified: 2023-02-04 10:42 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch fixing the problem. (518 bytes, text/x-python-script)
2023-02-01 20:12 UTC, Thomas Klausner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Klausner 2023-02-01 20:12:54 UTC
Created attachment 155858 [details]
Patch fixing the problem.

With the default C locale on NetBSD, the fixappdata.py script as run in the build reports an error:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 305: ordinal not in range(128)

Please apply the attached patch to give fileinput.input() an explicit encoding argument - this fixes the issue.
Comment 1 Urs Fleisch 2023-02-04 07:18:13 UTC
Thanks for the report. The Debian maintainer encountered the same issue, and I came up with the fix https://invent.kde.org/multimedia/kid3/-/commit/cdc47207d2807f47222e904e441f95a523724ed1 treating the file as binary, which is a bit more tolerant than your solution. Is this OK for you too?
I am still wondering why this affects only fixappdata.py, but not fixdesktop.py, and if this is a feature or bug of Python 3.11 (the Debian maintainer made the conclusion that the Python update might be the cause).
Comment 2 Thomas Klausner 2023-02-04 10:42:50 UTC
Thanks for the information - the committed patch works for me.