Skip to content

RuntimeError: context has already been set. When I use both Sanic and loguru #974

@ChrisYP

Description

@ChrisYP
from sanic import Sanic, text
from loguru import logger

app = Sanic(__name__)


@app.get('/')
async def run_shell(request):
    return text('Hello world!')


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=6666, debug=True, access_log=True, workers=2)

python version:3.8
Name: sanic
Version: 23.6.0
Name: loguru
Version: 0.7.1

The above code thorws an error:
raise RuntimeError('context has already been set')
RuntimeError: context has already been set

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions