[Twisted-Python] self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

Glyph glyph at twistedmatrix.com
Sun Aug 4 23:55:33 MDT 2019



> On Aug 4, 2019, at 9:04 PM, Waqar Khan <wk80333 at gmail.com> wrote:
> 
> Ah yes.. That is true..
> 
> If I comment out request.finish() (Here is the doc which I tried to followed: https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/interrupted.html <https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/interrupted.html>) 
> Then actually.. when I try to test out the code... (via curl or like doing requests.get .. to the URI).. 
> it is just stuck..

Yep!  This makes sense; if you don't call `.finish()` at all then your code will never tell the client that it's done.

But if you call `.finish()` after notifyFinish() has fired then you get that error.

If you change your code to only call `.finish()` if the deferred returned by notifyFinish() has not fired or failed yet, do you get the error?  It's possible that you still do, in which case, there's a bug in Twisted that needs to be fixed.

> I do want to convey my thanks for the help. Really appreciate it.

Thanks for using Twisted :)
-g

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20190804/9344b45f/attachment-0002.html>


More information about the Twisted-Python mailing list