Advertisement
Guest User

Untitled

a guest
May 23rd, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. java:
  2.  
  3. LoadPythonStuff(String modulePath, String moduleName)
  4. {
  5. PySystemState state = new PySystemState();
  6. state.append(modulePath)
  7.  
  8. PyObject importer = state.builtins.__getitem(Py.newString("__import__"));
  9. PyObject module = importer.__call__(Py.newString(moduleName));
  10. }
  11.  
  12. LoadPythonStuff("/path/to/foo", "bar")
  13. thrown ImportError module not found
  14.  
  15. jython console:
  16.  
  17. import sys
  18. sys.append("/path/to/foo")
  19. __import__ bar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement