Closed Marmaduke1st closed 2 months ago
Thanks for reporting. Does the issue happen if you try to initialize with another template (like the blank one)?
Good question, I'm not sure. Sorry for delay, I'll check and get back to you
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.
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:104Get 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 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
File "c:\Users\User\Documents\Ordi.venv\Lib\site-packages\typer\main.py", line 327, in
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_x64qbz5n2kfra8p0\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):