python 3 issue in io.py
jmmshn opened this issue · 1 comments
jmmshn commented
The line in io.py causes an AttributeError (sometimes)
lastchar = m_file.read(1).decode("utf-8")
Is not compatible in python 3 if the input file is not opened as a byte stream.
I get this exception when certain fireworks are restarted. But I haven't spent the time to track down the exact cause.
The line above breaks in the following way
AttributeError Traceback (most recent call last)
<ipython-input-10-aa14052e5034> in <module>
1 with open('text.file', 'r') as f:
----> 2 f.read(1).decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
but if you change it to f.read(1).decode("utf-8")
the code works.
If you think it's appropriate, I can modify the code to make it handle both 'r' and 'rb' read cases
shyuep commented
Sure, pls make the change. Thanks.