Regarding my previous post. I found and applyed the fix for the "Py Meta
Class Bug". Lo and behold the applet runs.
Now I get an error then exceuting the pageHandler function:
"LookupError: no codec search functions registered: can't find encoding"
Am I far off the mark when I suggest that jython2.x isn't quite ready for
this kind of applets yet? I haven't had any problems with applets that
don't use "Cpython" modules.
regards
Rune Hansen
On Thu, 26 Jul 2001, Rune Hansen wrote:
> I'm trying to create a (very) simple jython applet and theres obviously
> something I'm doing wrong.
>
> --applet code--
> import urllib
> import re
> from java.applet import Applet
> from java import awt
> class simpleHttp(Applet):
> def __init__(self):
> self.setBackground(awt.Color.white)
> self.setLayout(awt.FlowLayout())
> self.t1 = awt.TextField("",20)
> self.b1 = awt.Button("Get IP",actionPerformed=self.pageHandler)
> self.add(self.t1)
> self.add(self.b1)
> def pageHandler(self,event):
> pagehandler = urllib.urlopen("http://someserver/cgi-bin/getIp.py")
> data = pagehandler.read(512)
> ipaddr = re.findall("\d+\.\d+\.\d+\.\d+",data)
> pagehandler.close()
> self.t1.setText(ipaddr[0])
> --applet--
>
> I proceed to compile with "jythonc -c -d -j simpleHttp.jar
> simpleHttp.py" and it compiles fine using both 2.0 and 2.1a2. When
> executed it however exits with:"java.lang.ExceptionInInitializerError:
> java.lang.ExceptionInInitializerError" when compiled with 2.0 and
> "java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError:
> org/python/util/PyMetaClass" when compiled with 2.1.a2.
--
|