I don't know how to get a multi-file program byte-compiled properly. I
wrote two simple files - one has a base class, and the other one imports
that module, and defines another class that inherits from that first class.
Here they are:
base.py:
class main:
def funcMain(self):
print "main func"
sub.py:
import base
class sub(base.main):
def funcSub(self):
print "sub func"
if __name__=="__main__":
a = sub()
a.funcMain()
a.funcSub()
Running sub.py works just fine in cpython and jython. When I run jythonc it
compiles. In the current directory, it creates a file called base$py.class.
It also creates a jpywork/ directory which contains the files
sub$_PyInner.class, sub.class, and sub.java.
When I try to run java sub from the jpywork/ directory, I get this error:
java sub
Java Traceback:
at org.python.core.Py.ImportError(Py.java:180)
at org.python.core.imp.load(imp.java:368)
at org.python.core.imp.load(imp.java:376)
at org.python.core.imp.importName(imp.java:447)
at org.python.core.imp.importName(imp.java:509)
at org.python.core.ImportFunction.load(__builtin__.java:967)
at org.python.core.ImportFunction.__call__(__builtin__.java:961)
at org.python.core.PyObject.__call__(PyObject.java:250)
at org.python.core.__builtin__.__import__(__builtin__.java:921)
at org.python.core.imp.importOne(imp.java:518)
at sub$_PyInner.main$3(sub.java:56)
at sub$_PyInner.call_function(sub.java:38)
at org.python.core.PyTableCode.call(PyTableCode.java:155)
at org.python.core.imp.createFromCode(imp.java:157)
at org.python.core.Py.runMain(Py.java:798)
at sub.main(sub.java:76)
Traceback (innermost last):
File "D:\junk\sub.py", line 0, in main
ImportError: no module named base
I also tried compiling base.py separately, but still no dice. What am I
doing wrong?
--------------------------------------------------------------------------
C. Porter Bassett cporter at byu dot edu www.et.byu.edu/~porter
odigo #: 3854128 ICQ #:38435505 AIM ID: cporterbassett
--------------------------------------------------------------------------
"Pretend like this is a really witty saying." - Anonymous
--------------------------------------------------------------------------
|