Open TA2k opened 2 years ago
Looks to be just a python error regarding your project structure. Does that python.py
script of yours actually run successfully if you launch it on its own? Because I don't believe it would unless you've configured the module_name/__init__.py
file to correctly expose your API functions (i.e. connect()
). It should work if your __init__.py
file looks something like this:
from .code import connect
# import other functions to expose
__all__ = [
"connect",
# names of all imported functions to be exposed
]
Don't believe this is a pythonia issue.
It is working with python3 python.py It looking like this
__all__ = (
"connect"
)
def connect( )....
You can try it by yourself, for example with the space.js example remove pygame via pip and install pygame locally
pip3 install pygame -t .
and rerun space.js
pip3 install pygame
is working
@extremeheat do you have an idea to import local installed modules?
Got the same problem. Solve it by including the search path manually:
const sys = await python('sys');
await sys.path.insert(0,'.');
const module_name = await python('module_name')
I copied a python module in my folder and not installed via pip With a python script this import ist working but not via pythonia in javasript
Folder:
python.py:
On javascript this is not working javasript.js
Used module: https://github.com/nbogojevic/midea-beautiful-air/tree/main/midea_beautiful