Questions tagged [tinycss]

CSS parser for Python

tinycss is a complete yet simple CSS parser for Python. It supports the full syntax and error handling for CSS 2.1 as well as some CSS 3 modules:

  • CSS Color 3
  • CSS Paged Media 3

It is designed to be easy to extend for new CSS modules and syntax, and integrates well with cssselect for Selectors 3 support.

3 questions
5
votes
1 answer

FileNotFoundError: [Errno 2] No such file or directory: 'tinycss2\\VERSION'

The full error is: FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\grossj\\AppData\\Local\\Temp\\_MEI143642\\tinycss2\\VERSION' [21148] Failed to execute script main The full error log is: Traceback (most recent call last): …
JareBear
  • 467
  • 9
  • 27
5
votes
0 answers

Get computed style for an element with tinycss

Given a css stylesheet and some XML / HTML elements, how can I use tinycss to get the computed style of an element? For example: p { font-family: Arial; } .foo { color: red; }

I would like to inspect the inner…
jdm
  • 9,470
  • 12
  • 58
  • 110
1
vote
1 answer

how to catch a non-fatal error in python

I'm using the parse_declaration_list function from tinycss2 which parses css. When I give it invalid css it returns [< ParseError invalid>]. However, I can't for the life of me figure out how to actually catch this error. I've tried: try: …
vorpal
  • 268
  • 4
  • 17