You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug is about a custom component lib, the cookiecutter template I'm using is the TS one but I have the same issue also with the standard template
Describe the bug
I created a custom Dash components library via cookiecutter template and when I run npm run build I receive an error:
Generated ButtonOutline.py
Generated Card.py
Generated CardBody.py
Traceback (most recent call last):
File "C:\Users\LQ6211\dev\experiments\engie_dash\components\.venv\Scripts\dash-generate-components-script.py", line 33, in <module>
sys.exit(load_entry_point('dash==2.5.1', 'console_scripts', 'dash-generate-components')())
File "C:\Users\LQ6211\dev\experiments\engie_dash\components\.venv\lib\site-packages\dash\development\component_generator.py", line 242, in cli
generate_components(
File "C:\Users\LQ6211\dev\experiments\engie_dash\components\.venv\lib\site-packages\dash\development\component_generator.py", line 136, in generate_components
components = generate_classes_files(project_shortname, metadata, *generator_methods)
File "C:\Users\LQ6211\dev\experiments\engie_dash\components\.venv\lib\site-packages\dash\development\_py_components_generation.py", line 195, in generate_classes_files
generator(
File "C:\Users\LQ6211\dev\experiments\engie_dash\components\.venv\lib\site-packages\dash\development\_py_components_generation.py", line 174, in generate_class_file
f.write(class_string)
File "C:\Program Files\Python310\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 '\u221e' in position 354214: character maps to <undefined>
The concerned snippet of code is in _py_components_generation.py:
and if I add an encoding to the open() function, the error disappears, for example open(file_path, "w", encoding="utf-8").
Of course if I remove the strange character (∞) that caused the issue from the components PropTypes, the build goes well, but it would be nice to support it.
Furthermore, I'm using Typescript so the components PropTypes are pulled in from TS types, so it's a bit out of my control and I can't really remove weird chars (I need to Omit<> TS properties from types).
Expected behavior
To just have the .py files generated correctly even if they contain strange chars like ∞
The text was updated successfully, but these errors were encountered:
lucafaggianelli
changed the title
[BUG] Custom components error during build
[BUG] Custom components error during build - char encoding
Jul 13, 2022
Describe your context
Please provide us your environment, so we can easily reproduce the issue.
This bug is about a custom component lib, the cookiecutter template I'm using is the TS one but I have the same issue also with the standard template
Describe the bug
I created a custom Dash components library via cookiecutter template and when I run
npm run build
I receive an error:The concerned snippet of code is in
_py_components_generation.py
:and if I add an encoding to the
open()
function, the error disappears, for exampleopen(file_path, "w", encoding="utf-8")
.Of course if I remove the strange character (∞) that caused the issue from the components
PropTypes
, the build goes well, but it would be nice to support it.Furthermore, I'm using Typescript so the components
PropTypes
are pulled in from TS types, so it's a bit out of my control and I can't really remove weird chars (I need toOmit<>
TS properties fromtype
s).Expected behavior
To just have the
.py
files generated correctly even if they contain strange chars like∞
The text was updated successfully, but these errors were encountered: