Issue with pylupdate7 on Windows

Phil Thompson phil at riverbankcomputing.com
Sun May 30 12:33:17 BST 2021


On 29/05/2021 13:11, Detlev Offenbach wrote:
> 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.

The next snapshot will handle and embedded coding line.

Phil


More information about the PyQt mailing list