Hello. I'm new to python / jython.
There was a problem: you need to download files from a specific directory.
Local, no problem
for name in glob.glob("%s/*.json" % some_path): log.debug(name) definition = json.loads(file(name).read()) The problem is this: the main application to java is distributed as jar (s), and all resources are also located in jar'e.
The path to the resource folder is defined in jave:
URL resourceURL = CommonMethods.class.getClassLoader().getResource(resourceName); String resourcePath = resourceURL.getPath(); String dirPath = resourcePath.substring(0, resourcePath.lastIndexOf("/")+1); If the resource is in jar'e, then we get
dirPath="file:/opt/lib/core-lib-1.0.jar!/rulz/" And glob.glob() doesn't work, I think file(name).read() too. :(
Tell me how to read python files from jar'a?