mankyd / htmlmin

A configurable HTML Minifier with safety features
https://htmlmin.readthedocs.org/en/latest/
Other
129 stars 40 forks source link

Fix encoding problem with python3 #35

Closed iffy closed 7 years ago

iffy commented 8 years ago

This fixes my immediate problem, but I'm not sure if it causes problems...

This is the behavior I was seeing:

$ echo 'hello' | python3 -m htmlmin.command -s 
Traceback (most recent call last):
  File "/Users/matt/.pyenv/versions/3.4.3/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/matt/.pyenv/versions/3.4.3/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/private/tmp/htmlmin/htmlmin/command.py", line 168, in <module>
    main()
  File "/private/tmp/htmlmin/htmlmin/command.py", line 158, in main
    for line in inp.readlines():
  File "/Users/matt/.pyenv/versions/3.4.3/lib/python3.4/codecs.py", line 611, in readlines
    data = self.read()
  File "/Users/matt/.pyenv/versions/3.4.3/lib/python3.4/codecs.py", line 493, in read
    data = self.bytebuffer + newdata
TypeError: can't concat bytes to str
iffy commented 8 years ago

@mankyd any chance you could review this? I'm currently just installing from my forked repo, but having the same version (as reported by pip) as this repo makes it hard to tell if installations contain this fix or not.