Message4809
Resource files in jars that are added via sys.path won't be found by
getRessource. Consider the pck.jar file that contains pck/Main.java and
the resource pck/Main.txt:
>>> import sys
>>> sys.path.append("pck.jar")
>>> import pck
*sys-package-mgr*: processing new jar,
'/home/boisgera/SANDBOX/JYTHON-BUGS/RESOURCE/pck.jar'
>>> pck.Main.getResource("Main.txt") is None
True
>>> pck.Main.getClassLoader()
org.python.core.SyspathJavaLoader@13d21d6
On the other hand, if 'pck.jar' is already in the CLASSPATH, I end up with:
>>> import pck
>>> pck.Main.getResource("Main.txt")
jar:file:/home/boisgera/SANDBOX/JYTHON-BUGS/RESOURCE/pck.jar!/pck/Main.txt
>>> pck.Main.getClassLoader()
sun.misc.Launcher$AppClassLoader@17182c1
I guess that 'findResource' should be implemented in SyspathJavaLoader
for this to work. The method 'getResourceAsStream' being already
implemented, I guess that most of the work has already been done ... right ? |
|
Date |
User |
Action |
Args |
2009-06-11 09:16:40 | boisgera | set | recipients:
+ boisgera |
2009-06-11 09:16:40 | boisgera | set | messageid: <1244711800.59.0.368004443637.issue1373@psf.upfronthosting.co.za> |
2009-06-11 09:16:40 | boisgera | link | issue1373 messages |
2009-06-11 09:16:39 | boisgera | create | |
|