[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 21:54:08 MDT 2019



> On Aug 4, 2019, at 8:43 PM, Waqar Khan <wk80333 at gmail.com> wrote:
> 
> Just for sake of completeness:
> def print_json_response(resp, request):
>          request.write(json.dumps(resp))
>          request.close()

Presumably this line actually says "request.finish()"?

This is indeed the problem; just don't call "request.finish()" if notifyFinish() has already been callback'd.

-g




More information about the Twisted-Python mailing list