<html><div style='background-color:'><DIV>Being very new to Jython I took a sample chunk of code from "Python<BR>Essential<BR>Reference" by David Beazley to try it out. When I ran it using jython<BR>it ran<BR>just fine. I then wanted to see what the generated java code would<BR>look like<BR>so I ran jythonc against this sample bit of code and I got the<BR>following<BR>error message:<BR><BR>[colin@... colin]$ jythonc /home/colin/sample.jpy<BR>Traceback (innermost last):import SocketServer<BR> File "/usr/local/jython-2.1/Tools/jythonc/jythonc.py", line 5, in ?<BR> File "/usr/local/jython-2.1/Tools/jythonc/main.py", line 300, in<BR>main<BR> File "/usr/local/jython-2.1/Tools/jythonc/main.py", line 214, in<BR>doCompile<BR>AttributeError: instance of 'Resource' has no attribute 'file'<BR><BR>I understand that certain python bits are not available under jython<BR>(namely C routines) but I would have thought that if the code worked<BR>under jython then<BR>jythonc should have no trouble compling it. Or am I totally<BR>misunderstanding<BR>something here (and I would not be surprised if I am).<BR><BR><BR>Here is the contents of sample.jpy<BR><BR>import SocketServer<BR>import socket<BR>import string<BR>class EchoHandler(SocketServer.BaseRequestHandler):<BR> def handle(self):<BR> f = self.request.makefile()<BR> self.request.send("HTTP/1.0 200 OK\r\n")<BR> self.request.send("Content-type: text/plain\r\n\r\n")<BR> self.request.send("Received connection from %s \r\n\r\n"<BR>%(self.client_address,))<BR> while 1:<BR> line = f.readline()<BR> self.request.send(line)<BR> if not string.strip(line):<BR> break<BR> f.close()<BR>serv = SocketServer.TCPServer(("",8051),EchoHandler)<BR>serv.serve_forever()<BR><BR>I get the funny feeling that I am fundamentally not understanding something (big picture) so any insight into this would be most appreciated. Thanks.<BR><BR>./CK<BR></DIV></div><br clear=all><hr>MSN Photos is the easiest way to share and print your photos: <a href='http://g.msn.com/1HM1ENCA/c156??PI=44318'>Click Here</a><br></html>
|