QssStylesheetEditor
QssStylesheetEditor copied to clipboard
Crash on Export Qss
Preconditions: Windows 10 x64, Python 3.8.2
- Install QSE via
pip install QssStylesheetEditor-1.6-py3-none-any.whl
in PowerShell - Start by
qsseditor
- Use menu
File - ExportQss
Result: QSE crashes, resulting qss-file has 0 size. PowerShell shows the following:
> PS E:\downloads> qsseditor
> starting...
> config file "c:\program files (x86)\python\lib\site-packages\i18n\list.toml" load successed!
> config file "c:\program files (x86)\python\lib\site-packages\config\config.toml" load successed!
> Preimporting 'PyQt5.Qsci' ... successfully in 0.004s.
> Preimporting 'res' ... successfully in 0.001s.
> Preimporting 'res.img_rc' ... successfully in 0.001s.
> Preimporting 'ui' ... successfully in 0.037s.
> Preimporting 'qss_template' ... successfully in 0.002s.
> coding: utf-8
> Editor syntax highlighting language: QSS
> Traceback (most recent call last):
> File "c:\program files (x86)\python\lib\site-packages\ui\mainwin.py", line 388, in export
> f.write(self.qsst.qss)
> File "c:\program files (x86)\python\lib\encodings\cp1251.py", line 19, in encode
> return codecs.charmap_encode(input,self.errors,encoding_table)[0]
> UnicodeEncodeError: 'charmap' codec can't encode characters in position 331-335: character maps to <undefined>
Additional info: According to Russian Stackoverflow the problem related to cp1251
coding. So I've changed line 387 in ui/mainwin.py
and that fixed the issue:
with open(savefile, 'w', newline='') as f:
to
with open(savefile, 'w', newline='', encoding='utf8') as f:
ok, fixed