Re: self.channel.writeHeaders(version, code, reason, headers)\nbuiltins.AttributeError: \'NoneType\' object has no attribute \'writeHeaders\'\

Glyph <[email protected]> Sun, 4 Aug 2019 22:55:33 -0700
Newsgroups gmane.comp.python.twisted
Message-ID <[email protected]>
--===============3534303507839007928==
Content-Type: multipart/alternative;
	boundary="Apple-Mail=_04AEDB5B-7BBB-4545-A8B6-07749C5B9196"


--Apple-Mail=_04AEDB5B-7BBB-4545-A8B6-07749C5B9196
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii



> On Aug 4, 2019, at 9:04 PM, Waqar Khan <[email protected]> wrote:
>=20
> Ah yes.. That is true..
>=20
> 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/interrupte=
d.html>)=20
> Then actually.. when I try to test out the code... (via curl or like =
doing requests.get .. to the URI)..=20
> 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


--Apple-Mail=_04AEDB5B-7BBB-4545-A8B6-07749C5B9196
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=us-ascii

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br =
class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div =
class=3D"">On Aug 4, 2019, at 9:04 PM, Waqar Khan &lt;<a =
href=3D"mailto:[email protected]" class=3D"">[email protected]</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><div =
dir=3D"ltr" class=3D"">Ah yes.. That is true..<div class=3D""><br =
class=3D""></div><div class=3D"">If I comment out request.finish() (Here =
is the doc which I tried to followed:&nbsp;<a =
href=3D"https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/int=
errupted.html" =
class=3D"">https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/=
interrupted.html</a>)&nbsp;</div><div class=3D"">Then actually.. when I =
try to test out the code... (via curl or like doing requests.get .. to =
the URI)..&nbsp;</div><div class=3D"">it is just =
stuck..</div></div></div></blockquote><div><br class=3D""></div><div>Yep! =
&nbsp;This makes sense; if you don't call `.finish()` <i class=3D"">at =
all</i><span style=3D"font-style: normal;" class=3D"">&nbsp;then your =
code will never tell the client that it's done.</span></div><div><span =
style=3D"font-style: normal;" class=3D""><br =
class=3D""></span></div><div>But if you call `.finish()` <i =
class=3D"">after notifyFinish() has fired</i><span style=3D"font-style: =
normal;" class=3D"">&nbsp;then you get that =
error.</span></div><div><span style=3D"font-style: normal;" class=3D""><br=
 class=3D""></span></div><div><span style=3D"font-style: normal;" =
class=3D"">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? &nbsp;It's possible that you still do, in which case, =
there's a bug in Twisted that needs to be fixed.</span></div><br =
class=3D""><blockquote type=3D"cite" class=3D""><div class=3D""><div =
dir=3D"ltr" class=3D""><div class=3D"">I do want to convey my thanks for =
the help. Really appreciate it.</div></div></div></blockquote><br =
class=3D""></div><div>Thanks for using Twisted =
:)</div><div>-g</div><div><br class=3D""></div></body></html>=

--Apple-Mail=_04AEDB5B-7BBB-4545-A8B6-07749C5B9196--


--===============3534303507839007928==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHdpc3RlZC1Q
eXRob24gbWFpbGluZyBsaXN0ClR3aXN0ZWQtUHl0aG9uQHR3aXN0ZWRtYXRyaXguY29tCmh0dHBz
Oi8vdHdpc3RlZG1hdHJpeC5jb20vY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3R3aXN0ZWQtcHl0
aG9uCg==

--===============3534303507839007928==--