How do you handle imports in pyscript_config.toml like imports and [[fetch]] with pyscript-react? #1868
Replies: 2 comments
-
OK so I answered my first question with trial and error. It seems the way you import the pyscript_config.toml file is like this:
However now I can't get it to find the actual script file. I keep getting "(PY0404): Fetching from URL geometry_generator.py failed with error 404 (Not Found). Are your filename and path correct?". I've tried every combination of file placement and path I can think of but it never seems to be able to find the file. In my old project I just had all the files in the same directory but that doesn't work here either. |
Beta Was this translation helpful? Give feedback.
-
Update 2: I seemingly got the pyscript_config.toml file loading, installing svgwrite and my custom library geometry_generator.py:
However, it then throws module not found when my script geometry_interface attempts to import geometry_generator:
So it seems like it is loading the library but then it says there's no module. |
Beta Was this translation helpful? Give feedback.
-
I am re-writing a new version of my portfilio and having trouble moving the PyScript part. the old version was plain HTML and JavaScript and the new one is Next js.
I don't see any explanation of how to use the pyscript_config.toml file using pyscript-react. I need to import external libraries (like svgwrite) as well as including my own Python scripts. This is my current pyscript_config.toml file:
And here is how I'm importing it and my other script in my React component:
However, this is not working. I'm getting "ModuleNotFoundError: No module named 'geometry_generator'" so clearly the pyscript config is not working
Beta Was this translation helpful? Give feedback.
All reactions