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


Hi,

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__
/usr/lib/pyshared/python2.7/cv2.so
>>> 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?

Thanks,
Sneha




------------------------------------------------------------------------------
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 >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users