[Stackless] stacklesssocket.py problems

Richard Tew richard.m.tew at gmail.com
Fri Jun 22 22:39:55 CEST 2007


On 6/22/07, Arnar Birgisson <arnarbi at gmail.com> wrote:
> Traceback (most recent call last):
>   File "stacklesswsgi\test\simpleapp.py", line 12, in <module>
>     s.start()
>   File "C:\G÷gn\Forritun\stackless-cp\cherrypy\stacklesswsgi\__init__.py",
> line 539, in start
>     stackless.run()
>   File "C:\G÷gn\Forritun\stackless-cp\cherrypy\stacklesswsgi\__init__.py",
> line 563, in comm
>     conn.communicate()
>   File "C:\G÷gn\Forritun\stackless-cp\cherrypy\stacklesswsgi\__init__.py",
> line 503, in communicate
>     req.simple_response("500 Internal Server Error", format_exc())
>   File "C:\G÷gn\Forritun\stackless-cp\cherrypy\stacklesswsgi\__init__.py",
> line 341, in simple_response
>     self.sendall("".join(buf))
>   File "C:\G÷gn\Forritun\stackless-cp\cherrypy\stacklesswsgi\stacklesssocket.py",
> line 177, in sendall
>     self.sendBuffer += data
> TypeError: unsupported operand type(s) for +=: 'NoneType' and 'str'
>
> Now, it seems that when the first socket is closed - the second one is
> closed as well! However, the conn object that calls close on the first
> socket doesn't even have a reference to the second one - so I ruled
> out that this is happening somewhere in that object.

Isn't what is happening above in the stacktrace that the close
exception (the TypeError) is being raised all the way to the top of
your application?

I think it is good practice to add handling to a custom tasklet class
so the callable they run is wrapped and has its exceptions caught.
Then you can log the exceptions out, print them, ignore them or
whatever.

Cheers,
Richard.

_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list