diff options
author | kernc <kerncece@gmail.com> | 2015-01-06 02:39:13 +0100 |
---|---|---|
committer | Kernc <kerncece@gmail.com> | 2015-01-06 14:21:50 +0100 |
commit | fd66919ecc7570ff1f3edd95f0dc5be8d8a8b888 (patch) | |
tree | a04dabe60fb84b3cea02ce00acde61ed76db61d4 /scss/tool.py | |
parent | f26e99445dc8eada34406fab7185480f252bdb6c (diff) | |
download | pyscss-fd66919ecc7570ff1f3edd95f0dc5be8d8a8b888.tar.gz |
Encode the output to UTF-8 before writing to file
Having run pyScss with `--watch`, it died with:
```
File "/usr/local/lib/python2.7/dist-packages/scss/tool.py", line 254, in compile
dest_file.write(self.css.compile(scss_file=src_path))
UnicodeEncodeError: 'ascii' codec can't encode character u'\uf0d7' in position 816: ordinal not in range(128)
```
Encoding to UTF-8, assuming that's what everyone wants, before writing the file, solves it.
Diffstat (limited to 'scss/tool.py')
-rw-r--r-- | scss/tool.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scss/tool.py b/scss/tool.py index 08abb44..a348e9c 100644 --- a/scss/tool.py +++ b/scss/tool.py @@ -250,8 +250,8 @@ def watch_sources(options): dest_path = os.path.join(os.path.dirname(src_path), fname) print("Compiling %s => %s" % (src_path, dest_path)) - dest_file = open(dest_path, 'w') - dest_file.write(self.css.compile(scss_file=src_path)) + dest_file = open(dest_path, 'wb') + dest_file.write(self.css.compile(scss_file=src_path).encode('utf-8')) def on_moved(self, event): super(ScssEventHandler, self).on_moved(event) |