Hi all,
I have a Python script that looks like this:
from jnius import autoclass
javapath = ".:/path/to/jar_files/*"
os.environ['CLASSPATH'] = javapath
print 'CLASSPATH: ', os.environ['CLASSPATH']
adb = autoclass('com.android.ddmlib.AndroidDebugBridge')
When I run it, it fails like so:
user@host:$ python foo.py
CLASSPATH: .:/path/to/jar_files/*
Traceback (most recent call last):
File "bin/python", line 33, in <module>
execfile(__file__)
File "ve_android/bar.py", line 9, in <module>
adb = autoclass('com.android.ddmlib.AndroidDebugBridge')
File "/usr/local/lib/python2.7/dist-packages/jnius/reflect.py", line 109, in autoclass
c = find_javaclass(clsname)
File "jnius_export_func.pxi", line 23, in jnius.find_javaclass (jnius/jnius.c:7134)
jnius.JavaException: Class not found 'com/android/ddmlib/AndroidDebugBridge'
But if I set CLASSPATH manually in the shell, and then run it, it works:
user@host:$ export CLASSPATH=".:/path/to/jar_files/*"
user@host:$ python foo.py
CLASSPATH: .:/path/to/jar_files/*
adb obj: <class 'jnius.reflect.com.android.ddmlib.AndroidDebugBridge'>
I would have expected my Python os.environ manipulations to have the same effect as exporting the env var in the shell, but no such luck. Any ideas?
Thanks,
Matt