windows permission error running uvicorn in command prompt

987 Views Asked by At

So, I am newbie. I have Anaconda. I used CMD.exe (available in navigator) to install uvicorn and fastapi as given in official tutorial. then did as given in first steps. But output is not as expected. Output is

(base) PS C:\Users\HP> uvicorn fasttest:app --reload
←[32mINFO←[0m:     Will watch for changes in these directories: ['C:\\Users\\HP']
←[32mINFO←[0m:     Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)
error walking file system: PermissionError [WinError 5] Access is denied: 'C:\\Users\\HP\\AppData\\Local\\Application Data'
←[32mINFO←[0m:     Started reloader process [←[36m←[1m10672←[0m] using ←[36m←[1mwatchgod←[0m
←[33mWARNING←[0m:  The --reload flag should not be used in production on Windows.
←[31mERROR←[0m:    Error loading ASGI app. Could not import module "fasttest".
error walking file system: PermissionError [WinError 5] Access is denied: 'C:\\Users\\HP\\AppData\\Local\\Application Data'

What should I do?

1

There are 1 best solutions below

0
On

I had the same problem. Fortunately, I found a simple solution. Run this from cmd.exe:

python -m uvicorn fasttest:app --reload