Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

ImportError: No module named 'tornado.stack_context #136

Open
donnlee opened this issue Oct 19, 2020 · 1 comment
Open

ImportError: No module named 'tornado.stack_context #136

donnlee opened this issue Oct 19, 2020 · 1 comment

Comments

@donnlee
Copy link

donnlee commented Oct 19, 2020

Issue #115 claims to have resolved this error. However, I still get the error with the latest pip packages.
What can I do to chase this down?

pip packages:

# pip3 list | egrep "opent|tornado|jaeger"
jaeger-client               4.3.0
opentracing                 2.3.0
opentracing-instrumentation 3.3.1
tornado                     6.0.3
Traceback (most recent call last):
  File "/av.runfiles/__main__/production/mission_service/mission_service_grpc.py", line 19, in <module>
    from production.mission_service import mission_service_lib
  File "/av.runfiles/__main__/production/mission_service/mission_service_lib.py", line 13, in <module>
    from opentracing_instrumentation import traced_function
  File "/usr/local/lib/python3.5/dist-packages/opentracing_instrumentation/__init__.py", line 21, in <module>
    from .request_context import get_current_span  # noqa
  File "/usr/local/lib/python3.5/dist-packages/opentracing_instrumentation/request_context.py", line 26, in <module>
    from opentracing.scope_managers.tornado import TornadoScopeManager
  File "/usr/local/lib/python3.5/dist-packages/opentracing/scope_managers/tornado.py", line 24, in <module>
    import tornado.stack_context
ImportError: No module named 'tornado.stack_context'
2020-10-19 17:44:02,240 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-10-19 17:44:03,096 INFO exited: grpc (exit status 1; not expected)
2020-10-19 17:44:04,116 INFO spawned: 'grpc' with pid 141
2020-10-19 17:44:05,139 INFO success: grpc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Traceback (most recent call last):
  File "mission_service.py", line 34, in <module>
    import opentracing_instrumentation.client_hooks
  File "/usr/local/lib/python3.5/dist-packages/opentracing_instrumentation/__init__.py", line 21, in <module>
    from .request_context import get_current_span  # noqa
  File "/usr/local/lib/python3.5/dist-packages/opentracing_instrumentation/request_context.py", line 26, in <module>
    from opentracing.scope_managers.tornado import TornadoScopeManager
  File "/usr/local/lib/python3.5/dist-packages/opentracing/scope_managers/tornado.py", line 24, in <module>
    import tornado.stack_context
ImportError: No module named 'tornado.stack_context'
@libnoon
Copy link
Contributor

libnoon commented Feb 25, 2021

As far as I understood, TornadoScopeManager is for old tornado versions based on gen.coroutine. If you're using tornado 6, you should use ContextVarsScopeManager instead.

See:
#118
opentracing-contrib/python-tornado#10

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants