Hi everyone,
When I try to run my sanic app, I’m getting the error below. I wasn’t actually having that, but, I’ve just started somehow. Do you have any idea regarding that?
app = Sanic("app", inspector=True)
app.blueprint(bp_group)
app.blueprint(openapi2_blueprint)
if __name__ == "__main__":
app.run(debug=True, dev=True)
Error
/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic_jwt/configuration.py:134: DeprecationWarning: There is no current event loop
if asyncio.get_event_loop().is_running():
/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic_jwt/initialization.py:308: UserWarning: Sanic JWT was initialized using the default secret available to the public. DO NOT DEPLOY your application until you change it. See https://sanic-jwt.readthedocs.io/en/latest/pages/configuration.html#secret for more information.
warn(
[2022-12-06 14:59:32 +0100] [30757] [INFO]
┌─────────────────────────────────────────────────────────────────────────────────┐
│ Sanic v22.9.1 │
│ Goin' Fast @ http://127.0.0.1:8000 │
├───────────────────────┬─────────────────────────────────────────────────────────┤
│ │ mode: production, single worker │
│ ▄███ █████ ██ │ server: sanic, HTTP/1.1 │
│ ██ │ python: 3.10.6 │
│ ▀███████ ███▄ │ platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35 │
│ ██ │ packages: sanic-routing==22.8.0, sanic-testing==22.9.0 │
│ ████ ████████▀ │ │
│ │ │
│ Build Fast. Run Fast. │ │
└───────────────────────┴─────────────────────────────────────────────────────────┘
[2022-12-06 14:59:32 +0100] [30757] [WARNING] Sanic is running in PRODUCTION mode. Consider using '--debug' or '--dev' while actively developing your application.
[2022-12-06 14:59:32 +0100] [30769] [INFO] Inspector started on: ('127.0.0.1', 6457)
/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/log.py:122: DeprecationWarning: [DEPRECATION v23.3] Duplicate route names detected: app.swagger.static. In the future, Sanic will enforce uniqueness in route naming.
warn(version_info + message, DeprecationWarning)
Process Sanic-Server-0-0:
Traceback (most recent call last):
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/app.py", line 1135, in _listener
maybe_coro = listener(app) # type: ignore
TypeError: blueprint_factory.<locals>.build_spec() missing 1 required positional argument: 'loop'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/worker/serve.py", line 106, in worker_serve
return _serve_http_1(
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/server/runners.py", line 271, in _serve_http_1
loop.run_until_complete(app._server_event("init", "after"))
File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/app.py", line 1555, in _server_event
await self.dispatch(
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/signals.py", line 197, in dispatch
return await dispatch
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/signals.py", line 167, in _dispatch
retval = await maybe_coroutine
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic/app.py", line 1137, in _listener
maybe_coro = listener(app, loop) # type: ignore
File "/home/recep/.cache/pypoetry/virtualenvs/app-loz7iaVp-py3.10/lib/python3.10/site-packages/sanic_openapi/openapi2/blueprint.py", line 231, in build_spec
if SANIC_VERSION >= SANIC_21_3_0:
NameError: name 'SANIC_VERSION' is not defined