Cant see traceback
See original GitHub issueclass FooConsumer(SyncConsumer):
def connect(self):
assert False
...
produces
WebSocket HANDSHAKING /foo/ [127.0.0.1:00000]
WebSocket DISCONNECT /foo/ [127.0.0.1:00000]
With no traceback
python==3.6.8
django==1.11.16
channels==2.2.0
daphne==2.1.0
channels-redis==2.1.1
asgi-redis==1.4.3
asgiref==2.2.0
macOS Mojave 10.14.1
When I try to reproduce this with a minimal setup, it gives traceback
Exception inside application:
File "/path/to/django_sandbox/venv/lib/python3.6/site-packages/channels/sessions.py", line 183, in __call__
...
File "/path/to/django_sandbox/foo/consumers.py", line 7, in connect
assert False
as expected.
Adding a print
logger.error("Exception inside application: %s", exception_output)
print(exception_output)
inside
daphne.server.Server.application_checker
allows me to see the output, so it seems daphne swallows the errors somehow.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:23 (3 by maintainers)
Top Results From Across the Web
PyCharm 2019.2 not showing Traceback on Exception
It throws an error, you pause. Traceback in the console is literally the last thing handler does. But you pause it before handler...
Read more >Understanding the Python Traceback
Python prints a traceback when an exception is raised in your code. The traceback output can be a bit overwhelming if you're seeing...
Read more >How to read a traceback in Python
When Python encounters an error in your code, it will print out a traceback. Let's talk about how to use tracebacks to fix...
Read more >traceback — Print or retrieve a stack traceback — Python 3.11 ...
Source code: Lib/traceback.py This module provides a standard interface to extract, format and print stack traces of Python programs.
Read more >A simple way to show stack trace on error in R - Kun Ren
Unfortunately, it is not quite helpful since we don't see anything like x + y if we don't read the source code of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey guys 🙂 ,
I think I found what’s the issue 🔥 🎉
So, what I did:
django-debug-toolbar
was causing the issue in our case 😦 So it’s not a channels issueI searched in the other issues and found this - https://github.com/django/channels/issues/1193 (there’s a suggested quickfix there)
I started debugging the django-debug-toolbar code to find the root of the problem and turned out that this class is causing it - https://github.com/jazzband/django-debug-toolbar/blob/87eb27ffb2d0aea60b8b139360ece4d9fc91b47e/debug_toolbar/utils.py#L222
It’s used by a code hooked to the python logging module and collects only the logs from the current thread (which channels is not part from) 😞
https://github.com/django/channels/issues/1340#issuecomment-539957522 - this was solving the problem because the
print
is forcing a message to the standart output rather than using the python logging moduleHope this will help someone ^
Same here
backend:
frontend: