View Single Post
Old 02-18-2019, 10:00 AM   #32
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,735
Karma: 206739468
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Quote:
Originally Posted by icallaci View Post
Problem with Sigil 0.9.11: if I right-click in a CSS file and select Reformat CSS (either Multiple Lines Per Style OR Single Line Per File), then I get the following error:

Spoiler:
Traceback (most recent call last):

File "D:/Sigil/python3lib\cssreformatter.py", line 191, in reformat_css
new_css_string = parsed_css.cssText.decode('utf-8', errors='replace')

File "D:/Sigil/plugin_launchers/python\css_parser\css\cssstylesheet.py", line 139, in _getCssText
return css_parser.ser.do_CSSStyleSheet(self)

File "D:/Sigil/python3lib\cssreformatter.py", line 42, in do_CSSStyleSheet
cssText = rule.cssText

File "D:/Sigil/plugin_launchers/python\css_parser\css\cssfontfacerule.py", line 76, in _getCssText
return css_parser.ser.do_CSSFontFaceRule(self)

File "D:/Sigil/python3lib\cssreformatter.py", line 68, in do_CSSFontFaceRule
out = cssparser.serialize.Out(self)

NameError: name 'cssparser' is not defined


The error only occurs if there are @font-face declarations in the CSS file. If I remove the @font-face declarations, everything is fine and there is no error. Any ideas?
Yes. That one was reported on Github and we have it fixed already. It only occurs when there's @fontface entries in the css. We hope to have a quick release of version 0.9.12 out very soon to address this and a couple of other issues.

In the meantime ... it's a very quick/easy fix if you wish to edit the file yourself.

Just change line 68 of "D:\Sigil\python3lib\cssreformatter.py", line 68, from
Code:
out = cssparser.serialize.Out(self)
to
Code:
out = css_parser.serialize.Out(self)
(Just the underscore)

You will probably have to run a basic text editor As Administrator to be able to write to the file.
DiapDealer is online now