can not run `--dev` from SANIC CLI on windows
See original GitHub issueDescribe the bug
while running sanic --dev server.app
occures an error:
Error while finding module specification for '__main__' (ValueError: __main__.__spec__ is None)
Code snippet server.py
from sanic import Sanic
from sanic.response import text
app = Sanic("MyHelloWorldApp")
@app.get("/")
async def hello_world(request):
return text("Hello, world.")
Expected behavior A clear and concise description of what you expected to happen.
Environment (please complete the following information):
- OS: windows 10
- Version: latest sanic
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:14 (9 by maintainers)
Top Results From Across the Web
Sanic app not working on windows - Moving forward
I am trying to run the basic sanic app on windows 10. But it is just stuck there showing this warning
Read more >Running Sanic
There are two main ways to run Sanic Server: Using app.run; Using the CLI. When using app.run you will just call your Python...
Read more >ValueError when trying to run sanic in dev mode
I'm not sure why you can't just run sanic --dev server.app . I get the same error as you. However, running python -m...
Read more >cannot import name 'CompositionView' from 'sanic.views'
Rasa Open Source version 3.0.4 Rasa SDK version No response Rasa X version No response Python version 3.7 What operating system are you ......
Read more >Sanic | Build fast. Run fast. — Sanic 22.9.1 documentation
Sanic makes use of uvloop and ujson to help with performance. If you do not want to use those packages, simply add an...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I need to investigate it more first. Meaning I need to get onto my windows laptop and see why the entry point is not working and whether it is an implementation issue or an OS issue.
@prryplatypus Yes, using the
--auto-reload
flag is sufficient to produce the same error.I just tried that workaround command on my first project (without any of the previous
__init__.py
workarounds) and it worked!The other workaround, which I have been using since I cannot use the CLI, involves setting up my
application.py
file to serve the app when directly imported, like……and then running
python application.py
orpython -m application
on the command line.