[channels2] issues with raven
See original GitHub issueI noticed that the raven library doesn’t play nicely with channels2:
$ ./manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1100558c8>
Traceback (most recent call last):
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/apps/registry.py", line 116, in populate
app_config.ready()
File "/Users/brianmay/tree/myro/channels/channels/apps.py", line 17, in ready
monkeypatch_django()
File "/Users/brianmay/tree/myro/channels/channels/hacks.py", line 10, in monkeypatch_django
from .management.commands.runserver import Command as RunserverCommand
File "/Users/brianmay/tree/myro/channels/channels/management/commands/runserver.py", line 4, in <module>
from daphne.server import Server
File "/Users/brianmay/tree/myro/daphne/daphne/server.py", line 5, in <module>
asyncioreactor.install()
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/twisted/internet/asyncioreactor.py", line 322, in install
installReactor(reactor)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/twisted/internet/main.py", line 32, in installReactor
raise error.ReactorAlreadyInstalledError("reactor already installed")
twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed
Just to be sure, I put an error condition in twisted/internet/reactor.py
to see what stack trace I would get when it is first loaded:
$ ./manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1069a7bf8>
Traceback (most recent call last):
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
module = import_module(entry)
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 936, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/__init__.py", line 54, in <module>
from raven.base import * # NOQA
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/base.py", line 37, in <module>
from raven.conf.remote import RemoteConfig
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/conf/remote.py", line 36, in <module>
DEFAULT_TRANSPORT = discover_default_transport()
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/conf/remote.py", line 18, in discover_default_transport
from raven.transport.threaded import ThreadedHTTPTransport
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/transport/__init__.py", line 18, in <module>
from raven.transport.registry import * # NOQA
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/transport/registry.py", line 18, in <module>
from raven.transport.twisted import TwistedHTTPTransport
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/raven/transport/twisted.py", line 16, in <module>
from twisted.web.client import (
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/twisted/web/client.py", line 39, in <module>
from twisted.internet import defer, protocol, task, reactor
File "/Users/brianmay/.pyenv/versions/myrocc2/lib/python3.6/site-packages/twisted/internet/reactor.py", line 35, in <module>
raise Meow()
NameError: name 'Meow' is not defined
To me, it looks like we have two libraries that both use twisted (not sure I understand why) and as a result clash.
I think raven uses twisted for async http sending stuff, although looking at the stack trace would suggest I would get the same error even if I hacked it to use HTTPTransport
instead of TwistedHTTPTransport
.
I have no idea what, if any, solution there is to this, or who to blame. However, I think this is going to be an important issue.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:22 (12 by maintainers)
Top Results From Across the Web
Raven Mixer channels not lining up with Logic Mixer
I do use a lot of summing track stacks in Logic, not sure if that causes any issues. The Internal mixer overlay is...
Read more >Newest 'raven' Questions - Stack Overflow
I have a problem related with sending log messages to Sentry server while using Django and Celery async tasks. I utilize Django 1.11,...
Read more >(PDF) Raven, a harbinger of Multi-Object Adaptive Optics ...
The goal of Raven is two-fold: first, Raven has to demonstrate that MOAO technical challenges can be solved and implemented reliably for ...
Read more >Raven spaceship - Star Conflict (v.2) - Download Free 3D ...
Raven spaceship from Star Conflict , based on Karanak's concept art ( go check his work, he got some nice spaceship concept !...
Read more >Raven Software na Twitteru: "We actually added Mono Audio ...
While we're talking #WZa11y, we'd like to thank everyone again who contributed to the #accessibility survey last week.
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
@maxmalysh The simple solution is just to import the daphe.server before the raven in the settings.py like this
Fixed with 3d8d82be3528cc0150dac0c8ade1f6c306b412e4, provided you put Channels above Raven in the INSTALLED_APPS list, which is the best I can do without modifying Raven to lazy-load its twisted HTTP transport.