I'm attempting to make use of a CPython library from a Jython program through a subprocess.call() to a python script.
I can make the call through the Jython interpreter without any problem.
[OpenJDK Server VM (Sun Microsystems Inc.)] on java1.6.0_22
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call('python /opt/fake.py', shell=True)
ok!
0
But when I call the script from within my Jython program being built in Eclipse/PyDev:
subprocess.call('python /opt/fake.py', shell=True)
Results in this:
Traceback (most recent call last):
File "/home/sarwar/jython2.5.2/Lib/site.py", line 62, in <module>
import os
File "/home/sarwar/jython2.5.2/Lib/os.py", line 50, in <module>
import posixpath as path
File "/home/sarwar/jython2.5.2/Lib/posixpath.py", line 216, in <module>
if not os._native_posix:
AttributeError: 'module' object has no attribute '_native_posix'
Any suggestions on how I can bring my script running under PyDev in line with the result from the interpreter?
Thanks in advance.
EDIT 1: I corrected my module imports to only use Jython libraries and the error persists.
EDIT 2: After doing some more testing, it seems like the spawned instance of CPython is stuck using the PythonPath for Jython. The allows me to call 'python --version' but import os fails killing my subscript.