Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Initialize properly #3810

Closed
Marmaduke1st opened this issue Aug 20, 2024 · 3 comments · Fixed by #3886
Closed

Unable to Initialize properly #3810

Marmaduke1st opened this issue Aug 20, 2024 · 3 comments · Fixed by #3886
Labels
bug Something isn't working

Comments

@Marmaduke1st
Copy link

Describe the bug
When running reflex init is get the following error.
(.venv) PS C:\Users\User\Documents\Ordi> reflex init
───────────────────────────────────────────── Initializing Ordi ─────────────────────────────────────────────
[10:07:34] Initializing the web directory. console.py:104

Get started with a template:
(0) blank (https://blank-template.reflex.run) - A minimal template
(1) dashboard (https://dashboard-new.reflex.run/) - A dashboard with tables and graphs
(2) sales (https://sales-new.reflex.run/) - An app to manage sales and customers
(3) ai_image_gen (https://ai-image-gen.reflex.run/) - An app to generate images using AI
(4) ci_template (https://cijob.reflex.run/) - A template for continuous integration
(5) api_admin_panel (https://api-admin-panel.reflex.run/) - An admin panel for an api.
(6) nba (https://nba-new.reflex.run/) - A data visualization app for NBA data.
(7) customer_data_app (https://customer-data-app.reflex.run/) - An app to manage customer data.
Which template would you like to use? (0): 2
[10:07:42] Initializing the app directory. console.py:104
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in run_code
File "C:\Users\User\Documents\Ordi.venv\Scripts\reflex.exe_main
.py", line 7, in
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\main.py", line 327, in call
raise e
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\main.py", line 310, in call
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\core.py", line 723, in main
return _main(
^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\core.py", line 193, in _main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\main.py", line 693, in wrapper
return callback(**use_params)
^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\reflex.py", line 151, in init
_init(name, template, loglevel, ai)
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\reflex.py", line 112, in _init
prerequisites.initialize_app(app_name, template)
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\utils\prerequisites.py", line 1504, in initialize_app
create_config_init_app_from_remote_template(
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\utils\prerequisites.py", line 1434, in create_config_init_app_from_remote_template
initialize_app_directory(
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\utils\prerequisites.py", line 519, in initialize_app_directory
path_ops.find_replace(
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\reflex\utils\path_ops.py", line 200, in find_replace
filepath.write_text(text)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1520.0_x64__qbz5n2kfra8p0\Lib\pathlib.py", line 1048, in write_text
return f.write(data)
^^^^^^^^^^^^^
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1520.0_x64__qbz5n2kfra8p0\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f60a' in position 1903: character maps to

To Reproduce
Steps to reproduce the behavior:
Create a new venv
install reflex

Expected behavior
I would expect it to say initialized and not return an error

Specifics (please complete the following information):

  • Python Version: 3.12
  • Pip: 24.2
  • Reflex Version: 0.5.9
  • OS: Win 11
@Marmaduke1st Marmaduke1st added the bug Something isn't working label Aug 20, 2024
@picklelo
Copy link
Contributor

Thanks for reporting. Does the issue happen if you try to initialize with another template (like the blank one)?

@Marmaduke1st
Copy link
Author

Good question, I'm not sure. Sorry for delay, I'll check and get back to you

@samarth9201
Copy link
Contributor

samarth9201 commented Sep 3, 2024

The issue arises due to a UnicodeEncodeError when reflex init encounters a non-ASCII character. The solution could be to specify UTF-8 encoding in the filepath.write_text function by adding encoding="utf-8" to handle all characters properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants