Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- java:
- LoadPythonStuff(String modulePath, String moduleName)
- {
- PySystemState state = new PySystemState();
- state.append(modulePath)
- PyObject importer = state.builtins.__getitem(Py.newString("__import__"));
- PyObject module = importer.__call__(Py.newString(moduleName));
- }
- LoadPythonStuff("/path/to/foo", "bar")
- thrown ImportError module not found
- jython console:
- import sys
- sys.append("/path/to/foo")
- __import__ bar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement