Issue with pylupdate7 on Windows

Detlev Offenbach detlev at die-offenbachs.de
Sat May 29 13:11:27 BST 2021


Hello Phil,

pylupdate7 will crash on Windows, if it has to parse a Python source 
file with 'strange' characters. The cause is, that on Windows a non-UTF8 
codec seems to be used (CP1215 or so). However, most Python sources are 
UTF-8. Therefore line 37 of lupdate/python_source.py should read

         with open(self.filename, encoding="utf-8") as f:

or you must read the file in binary mode, and analyze the first two 
lines for the existence of a coding line. If found use that coding to 
get a valid text. The default should be utf-8.

As it is now, the read call in line 38 will fail, if a utf-8 encoded 
character is found.

Regards,
Detlev

-- 
Detlev Offenbach
detlev at die-offenbachs.de



More information about the PyQt mailing list