Stated here, one can invoke Jython in source code in Unix platforms.
I’ve installed Jython and put the directory in PATH in windows.
How could I set this up to invoke Jython from .py code automatically? Thanks.
Make the example more specific and clear:
#!/usr/bin/env jython
import sys
sys.path.append("./package.jar")
import org.abc.name
ImportError: No module named org.abc.name
And if I run Jython bar.py from cmd, it did work. But running Python bar.py fails with the error.
An
ImportErroris already a Python error, so it looks like jython is working. You need, however, to set up the path.If
xxxstands for one of your Python modules, set upsys.pathto contain the appropriate directory before importing it.If
xxxstands for one of your Java modules, set up the Java Classpath to contain the appropriate directory or jar.If
xxxstands for a built-in module, it is probably not supported by jython yet. Have a look at the list of modules supported by jython. Some newer modules that are available on other Python platforms (such asjson) are not yet available in jython.