[Twisted-web] Re: [Twisted-Python] tracebacks in twisted web2

David Reid dreid at dreid.org
Tue Sep 25 22:56:01 EDT 2007


Hi Paul

On Sep 25, 2007, at 7:04 PM, Paul Perez wrote:

> Dear List:
>
> I am having a heck of a time trying to figure out why this  
> traceback is happening, and I was hoping that you could shed some  
> light on the situation. I am sorry for bothering you with this  
> simple thing, but I can't seem to figure it out!

No need to apologize, however twisted-web is a better list for this  
question.

<snip>

> ---------------------------------------------------------------------- 
> -------------------------------
> 2007-09-25 18:38:38-0700 [-] Original exception:
> 2007-09-25 18:38:38-0700 [-] Unhandled Error
>         Traceback (most recent call last):
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 304, in _startRunCallbacks
>
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 317, in _runCallbacks
>
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 281, in _continue
>
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 277, in unpause
>
>         --- <exception caught here> ---
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 317, in _runCallbacks
>
>           File "C:\Projects\PyServer\twisted\web2\server.py", line  
> 518, in _cbFinishRender
>
>         exceptions.TypeError: html is not a resource or a response

this exception usually indicates that a render method didn't return  
an IResponse object but instead returned a string (or none.)  The  
above code did not include anything that implemented IResource.

> 2007-09-25 18:38:39-0700 [-] Unhandled error in Deferred:
> 2007-09-25 18:38:39-0700 [-] Unhandled Error
>         Traceback (most recent call last):
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 317, in _runCallbacks
>
>           File "C:\Projects\PyServer\twisted\web2\server.py", line  
> 476, in _processingFailed
>
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 200, in addErrback
>
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 182, in addCallbacks
>
>         --- <exception caught here> ---
>           File "C:\Projects\PyServer\twisted\internet\defer.py",  
> line 317, in _runCallbacks
>
>           File "C:\Projects\PyServer\twisted\web2\server.py", line  
> 492, in _processingReallyFailed
>
>           File "C:\Python24\lib\site-packages\twisted\web2 
> \http.py", line 446, in writeResponse
>             self.chanRequest.writeHeaders(response.code,  
> response.headers)
>           File "C:\Projects\PyServer\twisted\web2\channel\http.py",  
> line 431, in writeHeaders
>
>           File "C:\Projects\PyServer\twisted\web2\channel\http.py",  
> line 466, in _writeHeaders
>
>         exceptions.AttributeError: 'HTTPChannelRequest' object has  
> no attribute 'transport'

This might have something to do with the fact that you're calling  
writeResponse.

You should never call writeResponse directly on a request object.   
You should _return_ an IResponse or a deferred which results in an  
IResponse from an IResource's render method.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20070925/e13d2530/attachment.htm


More information about the Twisted-web mailing list