[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Issue with pylupdate7 on Windows
From:       Detlev Offenbach <detlev () die-offenbachs ! de>
Date:       2021-05-29 12:11:27
Message-ID: f0986c8a-5cbe-b458-6e57-99e9413b72da () die-offenbachs ! de
[Download RAW message or body]

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@die-offenbachs.de

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic