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

Waqar Khan <[email protected]> Mon, 5 Aug 2019 00:04:27 -0400
Newsgroups gmane.comp.python.twisted
Message-ID <CAJuJkHN8+o3QQGOxU4HZmUb9nCeoy+uwsdeiRrPj1epn-i4mnw@mail.gmail.com>
--===============1620504391765875288==
Content-Type: multipart/alternative; boundary="000000000000907402058f56ceb0"

--000000000000907402058f56ceb0
Content-Type: text/plain; charset="UTF-8"

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
)
Then actually.. when I try to test out the code... (via curl or like doing
requests.get .. to the URI)..
it is just stuck..

In [491]: requests.get("http://0.0.0.0:9999/test ....with params " )
It just stays stuck :(


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


On Sun, Aug 4, 2019 at 11:55 PM Glyph <[email protected]> wrote:

>
>
> > On Aug 4, 2019, at 8:43 PM, Waqar Khan <[email protected]> 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
>
> _______________________________________________
> Twisted-Python mailing list
> [email protected]
> https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>

--000000000000907402058f56ceb0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Ah yes.. That is true..<div><br></div><div>If I comment ou=
t request.finish() (Here is the doc which I tried to followed:=C2=A0<a href=
=3D"https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/interrup=
ted.html">https://twistedmatrix.com/documents/13.0.0/web/howto/web-in-60/in=
terrupted.html</a>)=C2=A0</div><div>Then actually.. when I try to test out =
the code... (via curl or like doing requests.get .. to the URI)..=C2=A0</di=
v><div>it is just stuck..</div><div><br></div><div>In [491]: requests.get(&=
quot;<a href=3D"http://0.0.0.0:9999/test">http://0.0.0.0:9999/test</a> ....=
with params &quot; )<br></div><div>It just stays stuck :(=C2=A0</div><div><=
br></div><div><br></div><div>I do want to convey my thanks for the help. Re=
ally appreciate it.</div><div><br></div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Aug 4, 2019 at 11:55 PM Gly=
ph &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><b=
r>
<br>
&gt; On Aug 4, 2019, at 8:43 PM, Waqar Khan &lt;<a href=3D"mailto:wk80333@g=
mail.com" target=3D"_blank">[email protected]</a>&gt; wrote:<br>
&gt; <br>
&gt; Just for sake of completeness:<br>
&gt; def print_json_response(resp, request):<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 request.write(json.dumps(resp))<br>
&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 request.close()<br>
<br>
Presumably this line actually says &quot;request.finish()&quot;?<br>
<br>
This is indeed the problem; just don&#39;t call &quot;request.finish()&quot=
; if notifyFinish() has already been callback&#39;d.<br>
<br>
-g<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">Twist=
[email protected]</a><br>
<a href=3D"https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-pytho=
n" rel=3D"noreferrer" target=3D"_blank">https://twistedmatrix.com/cgi-bin/m=
ailman/listinfo/twisted-python</a><br>
</blockquote></div>

--000000000000907402058f56ceb0--

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

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVHdpc3RlZC1Q
eXRob24gbWFpbGluZyBsaXN0ClR3aXN0ZWQtUHl0aG9uQHR3aXN0ZWRtYXRyaXguY29tCmh0dHBz
Oi8vdHdpc3RlZG1hdHJpeC5jb20vY2dpLWJpbi9tYWlsbWFuL2xpc3RpbmZvL3R3aXN0ZWQtcHl0
aG9uCg==

--===============1620504391765875288==--