UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 29918
Closed this issue · 0 comments
simonmichael commented
Using brew-installed python 3.5.1 on OSX, at step "3. Run python3 taxes.py
again. It will generate inform.py
", we get:
$ python3 taxes.py
python3 taxes.py
Traceback (most recent call last):
File "taxes.py", line 102, in <module>
exec(open("taxforms.py").read())
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 29918: ordinal not in range(128)
because of the non-ascii hyphen at line 327 (and line 329):
f1040_sched_a_employee_expenses = cell("Unreimbursed employee expenses—job travel, union dues, job education, etc.", 21, "", flag="u itemizing", name="f1040_sched_a_employee_expenses", form="f1040_sched_a"),
Declaring UTF8 encoding at the top of the tax forms.py didn't help:
# -*- coding: utf-8 -*-
Replacing them with ascii hyphens fixed it.