Printing to console from async method inside django channels

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Printing to console from async method inside django channels

Chris Barry
I'm trying to print inside these methods in from this example in django channels:

https://github.com/andrewgodwin/channels-examples/blob/master/multichat/chat/consumers.py

But nothing is coming through to the console.

I haven't worked with python Async before, so I'm not sure if I'm doing something really stupid? The examples in the python docs seem to show prints working no problem

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Printing to console from async method inside django channels

Andrew Godwin-3
Hi Chris,

Since you also posted this to GitHub (https://github.com/django/channels/issues/967), I will answer there.

Andrew

On Thu, Mar 8, 2018 at 8:17 PM, Chris Barry <[hidden email]> wrote:
I'm trying to print inside these methods in from this example in django channels:


But nothing is coming through to the console.

I haven't worked with python Async before, so I'm not sure if I'm doing something really stupid? The examples in the python docs seem to show prints working no problem

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFwN1uqNjFOcPwO4F%3D8PodCiVd6ApQVxbtDbFyW%2BWqfR7AGw1w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Printing to console from async method inside django channels

Chris Barry
Thanks very much, double posting the solution here just in case it helps anyone else:


Ah, that didn't do it, so I did a full upgrade of channels, something in this set of upgrades sorted it.

pip install channels -U


Installing collected packages: asgiref, autobahn, daphne, Django, setuptools
Found existing installation: asgiref 2.1.6
Uninstalling asgiref-2.1.6:
Successfully uninstalled asgiref-2.1.6
Found existing installation: autobahn 17.10.1
Uninstalling autobahn-17.10.1:
Successfully uninstalled autobahn-17.10.1
Found existing installation: daphne 2.0.4
Uninstalling daphne-2.0.4:
Successfully uninstalled daphne-2.0.4
Found existing installation: Django 2.0.2
Uninstalling Django-2.0.2:
Successfully uninstalled Django-2.0.2
Found existing installation: setuptools 38.5.1
Uninstalling setuptools-38.5.1:
Successfully uninstalled setuptools-38.5.1
Successfully installed Django-2.0.3 asgiref-2.2.0 autobahn-18.3.1 daphne-2.1.0 setuptools-38.5.2



On Friday, 9 March 2018 12:31:32 UTC, Andrew Godwin wrote:
Hi Chris,

Since you also posted this to GitHub (<a href="https://github.com/django/channels/issues/967" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fchannels%2Fissues%2F967\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOUGHOa1N2h9ubk5skYftYI1lxZw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fchannels%2Fissues%2F967\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGOUGHOa1N2h9ubk5skYftYI1lxZw&#39;;return true;">https://github.com/django/channels/issues/967), I will answer there.

Andrew

On Thu, Mar 8, 2018 at 8:17 PM, Chris Barry <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="DLM9sX7oAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">chris...@makemoredigital.com> wrote:
I'm trying to print inside these methods in from this example in django channels:

<a href="https://github.com/andrewgodwin/channels-examples/blob/master/multichat/chat/consumers.py" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fandrewgodwin%2Fchannels-examples%2Fblob%2Fmaster%2Fmultichat%2Fchat%2Fconsumers.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGMJyLO1ceRl6gZbup897qtUrCtvw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fandrewgodwin%2Fchannels-examples%2Fblob%2Fmaster%2Fmultichat%2Fchat%2Fconsumers.py\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGMJyLO1ceRl6gZbup897qtUrCtvw&#39;;return true;">https://github.com/andrewgodwin/channels-examples/blob/master/multichat/chat/consumers.py

But nothing is coming through to the console.

I haven't worked with python Async before, so I'm not sure if I'm doing something really stupid? The examples in the python docs seem to show prints working no problem

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="DLM9sX7oAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="DLM9sX7oAAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django...@....
Visit this group at <a href="https://groups.google.com/group/django-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-users&#39;;return true;">https://groups.google.com/group/django-users.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-users/abc849e2-11fe-49ca-a936-7dfaf5b811b6%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7ac42fd6-8d24-45be-aa32-1012cde8c1a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.