>Let's consider the following module/pkg/dir hierarchy:
>all python files just contain:
>(0) If one executes a.py from TOP with CPython 1.5/1.6/2.0 everything
> works fine.
>(1) Jython instead fails to locate p1 relative to x package (stmt import p1.z in
>Built-in Package Support in Python 1.5
>( http://www.python.org/doc/essays/packages.html )
>is not explicit about loading packages relative to modules in pkgs, it only
>speaks about module (but pkgs "are" modules) rel. import, in any case CPython
>behaviour is to find p1 package relative to x package p0 completing import p1.z
>So jython seems buggy in this respect.
I agree, this is bug. Complex python applications depends on this
relative behaviour, so it should be fixed. OTOH, since no one have
reported the bug it does not have get a high priority.
(Once on python-dev, it was suggested that relative imports should look
in each package, the whole way up the package structure. If my memory
serves me right, there was a very high level of agreement that this
would be a good thing)
>Notice that jython correctly locate y.
>(2) If one compiles a.py with jythonc and the --deep option,
>p0.y will not be compiled. The relative import rule is ignored
>by jythonc. In my opinion this is a bug, and I know how possibly
Also a bug IMO. Also a low priority for the same reasons.
>Both bugs are better solved in the "grand" *loading cleanup...
>(a little note) Differently from jython, jythonc follows
>the proposed precedence py > java. For the rest (java loading)
>it uses the org.python.core runtime. Is that true?
I don't think so. jythonc creates a list of known java packages and
passes this list on to sys.add_package() during initialization. This
creates PyJavaPackages which is currently searched before the python
modules. I think. But hey, you're the expert <wink>.