peterbe / mincss

Tool for finding out which CSS selectors you're NOT using.
https://peterbe.github.io/mincss/
BSD 3-Clause "New" or "Revised" License
854 stars 92 forks source link

Fixed syntax and unicode encode errors. #20

Closed bernimoses closed 7 years ago

bernimoses commented 10 years ago

This fixed some errors in the run.py file.

  File "run.py", line 48
    print()
        ^
SyntaxError: invalid syntax
  File "run.py", line 5
    from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
Traceback (most recent call last):
  File "run.py", line 78, in <module>
    sys.exit(run(args))
  File "run.py", line 45, in run
    f.write(link.after)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 125: ordinal not in range(128)
adrientetar commented 10 years ago
Traceback (most recent call last):
  File "run.py", line 77, in <module>
    sys.exit(run(args))
  File "run.py", line 44, in run
    f.write(link.after.encode('utf-8'))
TypeError: must be str, not bytes

Python 3.4, Windows 7.

peterbe commented 10 years ago

Please change to use codecs instead of open and see if it works equally in python 3.4

peterbe commented 7 years ago

Can you take a stab at redoing this using codecs instead?

bernimoses commented 7 years ago

Updated.

peterbe commented 7 years ago

Thanks!