I am using the parseFile convenience method to read a css file but it is generating a huge amount of warning messages.
I have set validate=False
but it is still printing the messages.
I have tried to create a CSSParser object and initialising the log object and logging level to none but it is still printing warnings and errors.
I looked in the source code and couldn't see where these message are being created so it might be in something that parseFile calls.
Is there any way of stopping the CSSParser.parseFile() from generating message like the ones below?
WARNING CSSStylesheet: Unknown @rule found. [3:43150:@-webkit-keyframes]
WARNING CSSStylesheet: Unknown @rule found. [3:43329: @-moz-keyframes]
WARNING CSSStylesheet: Unknown @rule found. [3:43496: @keyframes]
WARNING CSSStylesheet: Unknown @rule found. [3:43643: @-webkit-keyframes]
WARNING Property: Unknown Property name. [3:79871: min-device-width]
WARNING Property: Unknown Property name. [3:79900: max-device-width]
ERROR MediaQuery: Unexpected syntax, expected "and" but found "(". [3:86572: (]
ERROR MediaQuery: Unexpected syntax, expected "and" but found ":". [3:86582: :]
ERROR MediaQuery: Unexpected syntax. [3:86583: 35em]
ERROR MediaQuery: Unexpected syntax, expected "and" but found ")". [3:86587: )]
Any help would be greatly appreciated!
The logger is a singleton, so, put this line above your instruction
import logging
cssutils.log.setLevel(logging.CRITICAL)
This disables the warning and error logging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With