pythonpipenvquartasgihypercorn

Hypercorn - Can't find __main__ module in folder


I'm using Quart(Flask async) with debug=True and its builtin Hypercorn server, but everytime I save a file and the application tries to restart, I get :

C:\Users\myusername.virtualenvs\App-GtW9WS3s\Scripts\python.exe: can't find '__main__' module in 'C:\Users\myusername\OneDrive'

I think this is related to Hypercorn but it honestly could be anything and the questions about this error have a huge array of different solutions.

Worth nothing that I'm running Pipenv in Windows 10.

run.py :

from app import app as application

application.run(debug=True, host="gabriel.corp.carusojrea.com.br")

app/__init__.py :

from quart import Quart

app = Quart('__main__')

from app import views

Solution

  • According to the Quart documentation, you'll have to use __name__ instead of __main__.

    from quart import Quart
    
    app = Quart(__name__)
    

    And according to the Class documentation:

    Arguments:
        import_name: The name at import of the application, use
        ``__name__`` unless there is a specific issue.
    

    Give it a try!