[Stackless] error using socketlibevent.

Lucas Meijer lucas at mach8.nl
Sat Mar 22 15:33:59 CET 2008


Hi.

I'm new to stackless & socketlibevent. (and liking it!) It seems to work 
great for me when writing an initial server.
However, when writing a client program that tries to connect to the 
server, I get this error:

-----------------------------------------
C:\Documents and Settings\Lucas 
Meijer.LUCAS\Desktop\stacklessexamples\networking>\Python25_stackless\python.exe 
socket_test.py
2008-03-22 15:29:25,384 INFO about to create socket
2008-03-22 15:29:25,384 INFO about to connect
2008-03-22 15:29:25,384 INFO started connect
Traceback (most recent call last):
  File "socket_test.py", line 23, in <module>
    stackless.run()
  File "C:\Documents and Settings\Lucas 
Meijer.LUCAS\Desktop\stacklessexamples\networking\socketlibevent.py", 
line 184, in handle_connect
    raise socket.error, (err, errorcode[err])
AttributeError: 'function' object has no attribute 'error'
--------------------------------------------------


When running this program:


-------------------------------
import stackless
import socketlibevent as socket
import logging

def connect():
  logging.info("about to create socket")
  mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  logging.info("about to connect")
  mySocket.connect(("127.0.0.1",3000))
  logging.info("started connect")
 
  while mySocket.connected == False:
    stackless.schedule()
 
  logging.info("Connected!!")
 
  while True:
    print mySocket.recv(1024)
 
 
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s 
%(levelname)s %(message)s')
stackless.tasklet(connect)()
stackless.run()
--------------------------------------------


I'm using revision 86 of stacklesssocket.py, the same happened on rev 
85, on windows xp.

Am I using socketlibevent incorrectly? Is it a bug in socketlibevent?

Bye, Lucas



More information about the Stackless mailing list