jythonc AttributeError -- Works OK When Invoked Via Jython
CK
fw58959 at hotmail.com
Wed Jul 3 01:50:04 EDT 2002
Being very new to Jython I took a sample chunk of code from "Python
Essential
Reference" by David Beazley to try it out. When I ran it using jython
it ran
just fine. I then wanted to see what the generated java code would
look like
so I ran jythonc against this sample bit of code and I got the
following
error message:
[colin at linux1 colin]$ jythonc /home/colin/sample.jpy
Traceback (innermost last):import SocketServer
File "/usr/local/jython-2.1/Tools/jythonc/jythonc.py", line 5, in ?
File "/usr/local/jython-2.1/Tools/jythonc/main.py", line 300, in
main
File "/usr/local/jython-2.1/Tools/jythonc/main.py", line 214, in
doCompile
AttributeError: instance of 'Resource' has no attribute 'file'
I understand that certain python bits are not available under jython
(namely C routines) but I would have thought that if the code worked
under jython then
jythonc should have no trouble compling it. Or am I totally
misunderstanding
something here (and I would not be surprised if I am).
Here is the contents of sample.jpy
import SocketServer
import socket
import string
class EchoHandler(SocketServer.BaseRequestHandler):
def handle(self):
f = self.request.makefile()
self.request.send("HTTP/1.0 200 OK\r\n")
self.request.send("Content-type: text/plain\r\n\r\n")
self.request.send("Received connection from %s \r\n\r\n"
%(self.client_address,))
while 1:
line = f.readline()
self.request.send(line)
if not string.strip(line):
break
f.close()
serv = SocketServer.TCPServer(("",8051),EchoHandler)
serv.serve_forever()
Any insight into this would be most appreciated. Thanks.
./CK
More information about the Python-list
mailing list