25.09.2013 10:15, Sneha Murganoor kirjoitti:

---------- Forwarded message ----------
From: Sneha Murganoor <sneha.nie@gmail.com>
Date: Wed, Sep 25, 2013 at 10:43 AM
Subject: Fwd: import .so files using PythonInterperter
To: jython-users@lists.sourceforge.net


I am facing probs to import .so file using PythonInterperter from Java.

You cannot do that with Jython. You can only import pure Python code or Java classes.

From python:
$ python
Python 2.7.3 (default, Apr 10 2013, 06:20:15)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> print cv2.__file__
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit

>From Java:
PythonInterpreter ie = new PythonInterpreter();
ie.exec("import cv2");

$ javac InterperterExample.java
$java InterperterExample
Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named cv2

But importing other modules like numpy works perfectly fine.

How to resolve this?


October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >

Jython-users mailing list