dependency problem with jythonc
Juu
kexx at iname.com
Fri Apr 13 02:50:54 EDT 2001
Hello again,
I still haven't found a good solution for this on my own (right now I'm only
compiling the root servlet and having the rest of them in the path). :-(.
Is anyone else able to do a full compile of a (non-trivial) Jython
application to Java at all?
If so, how do you do it?
Best regards,
Juris.
----- Original Message -----
> Hello,
> I was trying to freeze (actually web/servlet-ize, but that's besides the =
> point) my Jython application, and failed - I must be doing something =
> totally wrong. :-(.
>
> Here's a short failure scenario:
>
> -- module Main.py in root/current package --
> # commented -- from amod.A import A
> from bmod.B import B
>
> B().bfunc()
> -- end Main.py --
>
> -- module A.py in package/directory apkg --
> class A:
> def afunc(self):
> return "kermits"
> -- end A.py --
>
> -- module B.py in package/directory bpkg --
> from apkg.A import A
>
> class B:
> def bfunc(self):
> print A().afunc()
> -- end B.py --
>
> I also have 2 empty __init__.py files (one for apkg, the other for =
> bpkg).
>
> Now, "jython Main.py" works just fine ("kermits" is printed).
> Here's the output from "jythonc --deep" at compile time:
>
> -- start --
> E:\projects\jytest\2>jythonc --deep Main.py
> processing Main
> processing bpkg.B
> processing apkg.A
> processing bpkg.__init__
>
> Required packages:
>
> Creating adapters:
>
> Creating .java files:
> B module
> Main module
> __init__ module
> A module
>
> Compiling .java to .class...
> Compiling with args: ['E:\programming\java\jdk1.3\bin\javac.exe', =
> '-classpa
> th', '"E:\programming\jython\jython.jar;E:\program =
> files\borland\Interclie
> nt\interclient.jar;E:\programming\jython\jython.jar;E:\programming\=
> java\j
> 2sdkee1.3\lib\j2ee.jar;E:\programming\java\jakarta-tomcat-3.2.1\jyt=
> est\WE
> B-INF\classes;.;.\jpywork;;E:\programming\jython\Tools\jythonc;E:\=
> project
> s\jytest\2\.;E:\programming\jython\Lib;e:\programming\Jython\Lib=
> ;E:\pr
> ogramming\jython"', '.\jpywork\bpkg\B.java', =
> '.\jpywork\Main.java', '.\jp
> ywork\bpkg\__init__.java', '.\jpywork\apkg\A.java']
> 0 Note: Some input files use or override a deprecated API.
> Note: Recompile with -deprecation for details.
> -- end --
>
> Next, we go to "./jpywork" and do a "java Main" and get:
> -- start --
> Java Traceback:
>
> at org.python.core.Py.ImportError(Py.java:180)
> at org.python.core.imp.load(imp.java:384)
> at org.python.core.imp.load(imp.java:392)
> at org.python.core.imp.importName(imp.java:448)
> at org.python.core.imp.importName(imp.java:528)
> at org.python.core.ImportFunction.load(__builtin__.java:989)
> at org.python.core.ImportFunction.__call__(__builtin__.java:982)
> at org.python.core.PyObject.__call__(PyObject.java:252)
> at org.python.core.__builtin__.__import__(__builtin__.java:942)
> at org.python.core.imp.importFromAs(imp.java:586)
> at bpkg.B$_PyInner.main$3(B.java:54)
> at bpkg.B$_PyInner.call_function(B.java:36)
> at org.python.core.PyTableCode.call(PyTableCode.java:198)
> at org.python.core.PyCode.call(PyCode.java:13)
> at org.python.core.imp.createFromCode(imp.java:165)
> at org.python.core.imp.createFromClass(imp.java:186)
> at org.python.core.imp.loadPrecompiled(imp.java:258)
> at org.python.core.imp.loadFromPath(imp.java:269)
> at org.python.core.PyModule.impAttr(PyModule.java:39)
> at org.python.core.imp.dottedFind(imp.java:428)
> at org.python.core.imp.importName(imp.java:452)
> at org.python.core.imp.importName(imp.java:528)
> at org.python.core.ImportFunction.load(__builtin__.java:989)
> at org.python.core.ImportFunction.__call__(__builtin__.java:982)
> at org.python.core.PyObject.__call__(PyObject.java:252)
> at org.python.core.__builtin__.__import__(__builtin__.java:942)
> at org.python.core.imp.importFromAs(imp.java:586)
> at Main$_PyInner.main$1(Main.java:34)
> at Main$_PyInner.call_function(Main.java:26)
> at org.python.core.PyTableCode.call(PyTableCode.java:198)
> at org.python.core.PyCode.call(PyCode.java:13)
> at org.python.core.imp.createFromCode(imp.java:165)
> at org.python.core.Py.runMain(Py.java:818)
> at Main.main(Main.java:49)
> Traceback (innermost last):
> File "E:\projects\jytest\2\Main.py", line 0, in main
> File "E:\projects\jytest\2\bpkg\B.py", line 0, in main
> ImportError: no module named apkg
> -- end --
>
> Taking a look at the ./jpywork directory shows that __init__-s (.java, =
> .class and $_PyInner.class) have only been compiled for bpkg, but not =
> for apkg.
> I tried passing it multiple arguments to compile, but it then compiled =
> it to a different "package level".
>
> Now, if we uncomment the first line in Main.py to also "from apkg.A =
> import A" it works just fine (but importing all modules from the main =
> application seems an ugly hack). Nevertheless, that still seems to fail
> "plain" modules that just have "functions" inside, with no classes (will
> check once again on that).
>
>
> Any comments will be very appreciated.
>
> Best regards,
> Juris.
>
> P.S. I'm using Jython 2.1a1 and Sun's JDK 1.3.
More information about the Python-list
mailing list