reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[REF-1896] I found an error that when using the "reflex init" command gives me this error:

Open CrisBelDev opened this issue 2 years ago β€’ 7 comments

I found an error that when using the "reflex init" command gives me this error:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Scripts\reflex.exe\__main__.py", line 7, in <module>    
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\typer\main.py", line 328, in __call__ 
    raise e
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\typer\main.py", line 311, in __call__ 
    return get_command(self)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\typer\core.py", line 778, in main     
    return _main(
           ^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\typer\core.py", line 216, in _main    
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\typer\main.py", line 683, in wrapper
    return callback(**use_params)  # type: ignore
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\reflex.py", line 123, in init
    _init(name, template, loglevel)
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\reflex.py", line 84, in _init
    prerequisites.initialize_frontend_dependencies()
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\prerequisites.py", line 751, in initialize_frontend_dependencies
    processes.run_concurrently(install_node, install_bun)
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\processes.py", line 199, in run_concurrently
    with run_concurrently_context(*fns):
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 144, in __exit__
    next(self.gen)
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\processes.py", line 186, in run_concurrently_context
    task.result()
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\CHICHO\AppData\Local\Programs\Python\Python312\Lib\concurrent\futures\thread.py", line 58, in run    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\prerequisites.py", line 557, in install_node
    processes.show_status("Installing node", process)
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\processes.py", line 256, in show_status
    for line in stream_logs(message, process):
  File "C:\Users\CHICHO\Proyectos\pythonWeb\envpy\Lib\site-packages\reflex\utils\processes.py", line 223, in stream_logs
    for line in process.stdout:
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 17: invalid start byte

(I need help please)

REF-1896

CrisBelDev avatar Dec 17 '23 23:12 CrisBelDev

Please provide more details such as reflex version, python version etc. As suggested in the issue template.

Alek99 avatar Jan 18 '24 07:01 Alek99

I use:

venv: Python default Python: 3.11.7 Reflex: 0.3.9

and fixed it by changing the stream_logs function

VERY IMPORTANT!.txt

DANIElPEZ avatar Feb 07 '24 00:02 DANIElPEZ

@DANIElPEZ nice catch - could you put a PR up with your change, we can review it and make sure it works for future users

picklelo avatar Feb 07 '24 23:02 picklelo

I'm sorry, what is PR?

DANIElPEZ avatar Feb 08 '24 05:02 DANIElPEZ

I'm sorry, what is PR?

A PR is a github Pull Request

ElijahAhianyo avatar Feb 08 '24 15:02 ElijahAhianyo

reopening this since theres been no linked/merged related PR

ElijahAhianyo avatar Feb 08 '24 15:02 ElijahAhianyo

the readme it's when you have install reflex in venv, so have follow the steps in readme, if you read readme, you will need to modify stream logs function

the page: https://github.com/DANIElPEZ/DaniDev-software

DANIElPEZ avatar Feb 08 '24 16:02 DANIElPEZ

if anyone else hits this, please feel free to open a new ticket with a bit more documentation and repro code

adhami3310 avatar Feb 04 '25 02:02 adhami3310