|
From: Ted B. <te...@et...> - 2001-09-04 21:14:31
|
On Tuesday 04 September 2001 11:46, Finn Bock wrote: > [Ted Berg] > > >Background: < snip > > >and /path/to/jarfile!/subdirectory is not a valid addition and is ignored. > > Wrong. The jar file name must still and with .zip or .jar and normally > the subdirectory in the .jar file is not an absolute path. Try to add > > /path/to/jarfile.jar!subdirectory > > instead. Ahh. Java code loading resources from a .jar file requires the leading / for subdirectories. loading the image /path/to/jarfile.jar!subdirectory/foo.gif would fail where /path/to/jarfile.jar!/subdirectory/foo.gif would succeed. It never occurred to me to try it without the leading slash. *thanks*! > >If this is the > >case, why does an __init__.py placed in the jar root directory not get > >executed, allowing me to import subdirectories without the need for > >__init__.py files in them? > > It wouldn't make sense. If there is more than one .jar file on sys.path, > when should the __init__.py files be executed and in what namespace? Doh! Thanks. I hadn't thought of that scenario. > >Honestly, this isn't a really big deal. It makes for some strange looking > >import clauses if you're used to CPython ( from Lib import string ), > > Yuck! This is certainly the wrong approach. I believe it is already > possible to avoid this hackery entirely. Yeah, and since you've shown me the error of my ways I can do things *correctly* now. :) Thanks a million! ted |