No module named '_contextvars'
guillain opened this issue · 1 comments
guillain commented
Hello,
First of all thanks for your contribution :D
Sorry as I reach you due to a bug highlighted in the unittest.
Any idea on it for a quick fix?
Thanks in advance.
14:54:23 ======================================================================
14:54:23 ERROR: Failure: ModuleNotFoundError (No module named '_contextvars')
14:54:23 ----------------------------------------------------------------------
14:54:23 Traceback (most recent call last):
14:54:23 File ".venv/lib64/python3.6/site-packages/nose/failure.py", line 39, in runTest
14:54:23 raise self.exc_val.with_traceback(self.tb)
14:54:23 File ".venv/lib64/python3.6/site-packages/nose/loader.py", line 418, in loadTestsFromName
14:54:23 addr.filename, addr.module)
14:54:23 File ".venv/lib64/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
14:54:23 return self.importFromDir(dir_path, fqname)
14:54:23 File ".venv/lib64/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
14:54:23 mod = load_module(part_fqname, fh, filename, desc)
14:54:23 File "/usr/lib64/python3.6/imp.py", line 235, in load_module
14:54:23 return load_source(name, filename, file)
14:54:23 File "/usr/lib64/python3.6/imp.py", line 172, in load_source
14:54:23 module = _load(spec)
14:54:23 File "<frozen importlib._bootstrap>", line 684, in _load
14:54:23 File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
14:54:23 File "<frozen importlib._bootstrap_external>", line 678, in exec_module
14:54:23 File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
14:54:23 File "test/test_Tracking.py", line 11, in <module>
14:54:23 from main import app
14:54:23 File "test/../app/main.py", line 10, in <module>
14:54:23 from lib.middleware import MIDDLEWARES
14:54:23 File "test/../app/lib/middleware.py", line 2, in <module>
14:54:23 from starlette_context import plugins
14:54:23 File ".venv/lib64/python3.6/site-packages/starlette_context/__init__.py", line 10, in <module>
14:54:23 from starlette_context.middlewares.basic_context_middleware import ( # noqa
14:54:23 File ".venv/lib64/python3.6/site-packages/starlette_context/middlewares/basic_context_middleware.py", line 1, in <module>
14:54:23 from _contextvars import Token
14:54:23 ModuleNotFoundError: No module named '_contextvars'
tomwojcik commented
ContextVar
has been added in python3.7 and this pkg has this requirement listed on GitHub and in the docs. I see you're running 3.6 so it's pretty much impossible to make it work.
File ".venv/lib64/python3.6/site-packages/starlette_context/__init__.py
Either way, you probably don't want to run any ASGI lib/framework with python3.6 so the only solution is to update your python version.