Search code examples
python-3.xanacondasanic

"sanic tried to use loop.add_signal_handler but it is not implemented on this platform" windows 10


I am trying to run the basic sanic app on windows 10.

from sanic import Sanic
from sanic.response import json
app = Sanic('just-try')

@app.route("/")
async def test(request):
  return json({"hello": "world"})

if __name__ == "__main__":
  app.run(host="0.0.0.0", port=8000,workers=1)

But it is just stuck there showing this warning

sanic tried to use loop.add_signal_handler but it is not implemented on this platform

enter image description here

sanic - 19.12.2

python - 3.7.6 (anaconda env)

OS - windows 10

installed sanic by running-

set SANIC_NO_UVLOOP=true
set SANIC_NO_UJSON=true
pip install sanic

note: I had to manually download and copy aiofiles, hpack, hyperframe, h11, rfc3986, and hstspreload to the site-packages folder. otherwise getting import error.


Solution

  • Need to install sanic from git.

    set SANIC_NO_UVLOOP=true
    set SANIC_NO_UJSON=true
    pip install git+https://github.com/huge-success/sanic.git
    

    They will release version 20.3 with windows related bugs fixed.