Open cyw3 opened 2 years ago
Thank you for reporting this, we'll take a look into it shortly
Could you confirm if the issue appears in the latest release version 22.2.0?
version 22.2.0
The version 22.2.0 has the same issue.
Tracked internally on GR 41886
The problem is that the directory is not on the python path. When you run the commandline, the directory of the argument script is automatically put on the path. When you embed in Java, you need to do this manually. Two options:
// set PythonPath to the current working directory so we can import stuff from here
Context.newBuilder().allowAllAccess(true).option("python.PythonPath", ".") build();
# in test.py
## add the directory that this file is in to the search path
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
...
It works. Thanks.
Is there more doc proviced?
Describe the issue I use GraalPython to run multiple python files.
Steps to reproduce the issue Please include both build steps as well as run steps
def test(): print("test") test1.test1()
poly.export_value("test", test)
test()
Test with graalpython
Test with java
Describe GraalVM and your environment: