All the examples I’ve seen show how to include a simple module. How would I import a local library? Every way I try it I get ModuleNotFoundError.
Provide more details such as the code and actual error messages. Typically you would specify the modules using
<py-env> and then an
I was trying to use pyecore library which is not supported by pyodide.
EDIT: Actually pyecore is available in pyodide…the fist time I tried I got an error and I assumed it was not. But the initial question still remains, suppose I have a custom library just like pyecore.
- index.html - test.py - pyecore/ - __init__.py - ecore.py - ...
<!DOCTYPE html> <html> <head> <link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> <script defer src="https://pyscript.net/alpha/pyscript.js"></script> <py-env> - paths: - /test.py - /pyecore/ecore.py </py-env> </head> <body> <py-script> from test import test test() </py-script> </body> </html>
test.py (but also other libraries) import pyecore simply by:
from pyecore.ecore import EClass
The error I get is:
File "", line 1, in File "/home/pyodide/test.py", line 10, in from pyecore.ecore import EClass ModuleNotFoundError: No module named 'pyecore'