Django Channel Demo Error From its site

51 views
Skip to first unread message

Aditya Bohra

unread,
Apr 29, 2020, 10:09:12 AM4/29/20
to Django users
I am trying to start with channels but the demo in python shell is not working properly:https://channels.readthedocs.io/en/latest/tutorial/part_2.html#enable-a-channel-layer
Its is showing some thing like this :
(InteractiveConsole)
>>> import channels.layers
>>> channel_layer = channels.layers.get_channel_layer()
>>> from asgiref.sync import async_to_sync
>>> async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})
Segmentation fault (core dumped)

please help

mohamed khaled

unread,
Apr 29, 2020, 10:18:02 AM4/29/20
to Django users
did you add channels_redis ??

Aditya Bohra

unread,
Apr 29, 2020, 1:07:20 PM4/29/20
to Django users
This is output of pip freeze
aioredis==1.3.1
asgi-redis==1.4.3
asgiref==3.2.0
async-timeout==3.0.1
attrs==19.3.0
autobahn==20.4.3
Automat==20.2.0
cachetools==4.0.0
certifi==2019.11.28
cffi==1.14.0
channels==2.4.0
channels-redis==2.4.2
chardet==3.0.4
constantly==15.1.0
cryptography==2.9.2
daphne==2.5.0
Django==2.2.6
google-api-core==1.16.0
google-api-python-client==1.8.0
google-auth==1.12.0
google-auth-httplib2==0.0.3
googleapis-common-protos==1.51.0
hiredis==1.0.1
httplib2==0.17.0
hyperlink==19.0.0
idna==2.9
incremental==17.5.0
msgpack==0.6.2
msgpack-python==0.5.6
oauth2client==4.1.3
protobuf==3.11.3
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyDrive==1.3.1
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pytz==2019.3
PyYAML==5.3.1
redis==2.10.6
requests==2.23.0
rsa==4.0
service-identity==18.1.0
six==1.14.0
sqlparse==0.3.0
Twisted==20.3.0
txaio==20.4.1
uritemplate==3.0.1
urllib3==1.25.8
zope.interface==5.1.0

Message has been deleted

Aditya Bohra

unread,
Apr 29, 2020, 1:12:32 PM4/29/20
to Django users
To view the stacktrace is used faulthandlers so that segmentation fault can be removed

I followed the tutorial on django channel site which has link: https://channels.readthedocs.io/en/latest/tutorial/part_2.html

 import channels.layers
 from asgiref.sync import async_to_sync
 print("running")
 channel_layer = channels.layers.get_channel_layer()
 async_to_sync(channel_layer.send)('test_channel', {'type': 'hello'})  <------ this is the cause of error but why i am not able to figure it out


Then i got Segmented fault error,
So the stack trace for the error was :



Fatal Python error: Segmentation fault

Current thread 0x00007f9657fff700 (most recent call first):
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/weakref.py", line 364 in remove

Thread 0x00007f965c99f700 (most recent call first):
  File "/usr/lib/python3.7/selectors.py", line 484 in close
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 89 in close
  File "/usr/lib/python3.7/asyncio/unix_events.py", line 55 in close
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/channels_redis/core.py", line 34 in _wrapper
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/asgiref/sync.py", line 124 in _run_event_loop
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57 in run
  File "/usr/lib/python3.7/concurrent/futures/thread.py", line 80 in _worker
  File "/usr/lib/python3.7/threading.py", line 870 in run
  File "/usr/lib/python3.7/threading.py", line 926 in _bootstrap_inner
  File "/usr/lib/python3.7/threading.py", line 890 in _bootstrap

Thread 0x00007f96605b6740 (most recent call first):
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/asgiref/current_thread_executor.py", line 65 in run_until_future
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/asgiref/sync.py", line 91 in __call__
  File "/home/abohra/Documents/Dev/ex/experimenting/tester.py", line 7 in <module>
  File "<frozen importlib._bootstrap>", line 219 in _call_with_frames_removed
  File "<frozen importlib._bootstrap_external>", line 728 in exec_module
  File "<frozen importlib._bootstrap>", line 677 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 967 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 983 in _find_and_load
  File "<console>", line 1 in <module>
  File "/usr/lib/python3.7/code.py", line 90 in runcode
  File "/usr/lib/python3.7/code.py", line 74 in runsource
  File "/usr/lib/python3.7/code.py", line 258 in push
  File "/usr/lib/python3.7/code.py", line 232 in interact
  File "/usr/lib/python3.7/code.py", line 301 in interact
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/commands/shell.py", line 81 in python
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/commands/shell.py", line 99 in handle
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/base.py", line 364 in execute
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/base.py", line 323 in run_from_argv
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 375 in execute
  File "/home/abohra/Documents/Dev/ex/env/lib/python3.7/site-packages/django/core/management/__init__.py", line 381 in execute_from_command_line
  File "./manage.py", line 17 in main
  File "./manage.py", line 21 in <module>
Any Help is Appreciated.



mohamed khaled

unread,
Apr 29, 2020, 11:40:08 PM4/29/20
to Django users
I have an idea try to download small project from github using channels and test it and see if works or not and tell me 


On Wednesday, 29 April 2020 16:09:12 UTC+2, Aditya Bohra wrote:
Reply all
Reply to author
Forward
0 new messages