reflex init error: UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 189: illegal multibyte sequence
Describe the bug
reflex init and upgrade Pynecone project, errors as following:
File "C:\Program Files\Python311\Lib\fileinput.py", line 251, in __next__ line = self._readline() ^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\fileinput.py", line 372, in _readline return self._readline() ^^^^^^^^^^^^^^^^ UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 189: illegal multibyte sequence
To Reproduce Steps to reproduce the behavior:
- Code/Link to Repo:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Specifics (please complete the following information):
- Python Version:
- Reflex Version:
- OS:
- Browser (Optional):
Additional context Add any other context about the problem here.
can you provide the code to reproduce this error?
Is it related to or similar with this issue https://github.com/pynecone-io/reflex/issues/1244? Not sure which part of code should I post there.
Ok, after couples of tests, I found that the problem is C:\Program Files\Python311\Lib\fileinput.py.
def __init__(self, files=None, inplace=False, backup="", *, mode="r", openhook=None, encoding="utf-8", errors=None):
By default, encoding is None, and I changed it to utf-8, reflex init worked. As for root cause, possibility is that some Chinese words there in a py file as reflex init tries to read every line of those py files in my app and replace specified words.