Message306

Author tlau
Recipients
Date 2001-05-17.23:45:52
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I'm compiling a test program that uses eval() to 
dynamically look up a class method.  I'm using Jython
2.0 on Linux with Sun JDK 1.3.0_01.  Here's the code:

<pre>
class Tlau(JApplet):
        def init(self):
                b = JButton('press me',
actionPerformed=self.foo)
                self.contentPane.add(b)

        def foo(self, event):
                print 'Foo!'
                barmethod = eval('self.bar')
                barmethod(event)

        def bar(self, event):
                print 'Bar!'
</pre>

If I then compile this with "jythonc --core --deep
--jar tlau.jar Tlau.py", and run the resulting jar file
with "java -jar tlau.jar", I get the error:

java.lang.NoClassDefFoundError: org/python/core/parser
        at org.python.core.Py.compile(Py.java:1422)
        at
org.python.core.__builtin__.compile(__builtin__.java:203)
        at
org.python.core.__builtin__.eval(__builtin__.java:252)
        at
org.python.core.__builtin__.eval(__builtin__.java:266)
        at java.lang.reflect.Method.invoke(Native
Method)
(etc.)

So I believe that to include the parser class I need to
use the --all flag to jythonc.  I try the same command,
adding --all, and jythonc bombs with this error:

Tracking java dependencies:
Traceback (innermost last):
  File
"/scratch/tlau/jython-2.0/Tools/jythonc/jythonc.py",
line 5, in ?
  File
"/scratch/tlau/jython-2.0/Tools/jythonc/main.py", line
301, in main
  File
"/scratch/tlau/jython-2.0/Tools/jythonc/main.py", line
294, in writeResults
  File "/scratch/tlau/jython-2.0/Tools/jythonc/jar.py",
line 98, in dump
  File "/scratch/tlau/jython-2.0/Tools/jythonc/jar.py",
line 92, in dumpFiles
  File "/scratch/tlau/jython-2.0/Tools/jythonc/jar.py",
line 111, in addPackage
java.util.zip.ZipException: duplicate entry:
org/python/core/StderrWrapper.class
History
Date User Action Args
2008-02-20 17:16:50adminlinkissue425015 messages
2008-02-20 17:16:50admincreate