reflex icon indicating copy to clipboard operation
reflex copied to clipboard

reflex init error: UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 189: illegal multibyte sequence

Open evandeng2009 opened this issue 2 years ago β€’ 2 comments

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.

evandeng2009 avatar Jul 12 '23 11:07 evandeng2009

can you provide the code to reproduce this error?

ElijahAhianyo avatar Jul 12 '23 13:07 ElijahAhianyo

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.

evandeng2009 avatar Jul 13 '23 04:07 evandeng2009

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.

evandeng2009 avatar Aug 10 '23 14:08 evandeng2009