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
I called python in kotlin and started reporting ModuleNotFoundError: No module named 'xxx'.
I added
import sys to the corresponding py file
import os
current_dir = os.path.dirname(os.path.abspath(file))
sys.path.append(current_dir)
Solution: NameError: name 'xxx' is not defined after recompilation
The suspect is from xxx import *, which is caused by mutual import, as shown in the figure, all.py files are custom.
The text was updated successfully, but these errors were encountered:
y1y2
changed the title
ModuleNotFoundError: No module named 'xxx' and NameError: name 'TraceContext' is not defined
ModuleNotFoundError: No module named 'xxx' and NameError: name 'xxx' is not defined
Jan 15, 2025
I don't understand your file layout, what is xxx? Where is it imported?
Does your python code work under CPython?
There is already a module named java in the standard library, it could be causing problems. Please rename the module or put all your modules into a package to namespace it.
I tried to modify the file name of java.py for java execution
”context.eval(source)“
No problem, but I use
“ctx.getBindings(mainScriptType).getMember("a").execute()”
Call a function a() in a.py, which calls the b() method in another b.py file with a
“NameError: name 'xxx' is not defined”,
xxx is a reference to a function under b(),
if I move b() to the a.y file, there is no problem, this has been troubling for a long time.
I called python in kotlin and started reporting ModuleNotFoundError: No module named 'xxx'.
I added
import sys to the corresponding py file
import os
current_dir = os.path.dirname(os.path.abspath(file))
sys.path.append(current_dir)
Solution: NameError: name 'xxx' is not defined after recompilation
The suspect is from xxx import *, which is caused by mutual import, as shown in the figure, all.py files are custom.
The text was updated successfully, but these errors were encountered: