0

I am getting the following error when I try to run my fastapi project

1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [WinError 2] The system cannot find the file specified 

I am using manage-fastapi as package manager for creating fastapi project find the link for manage-fastapi https://github.com/ycd/manage-fastapi

I am getting this error when I am executing fastapi run

2
  • 1
    Do you have uvicorn installed? Commented Nov 1, 2022 at 12:18
  • installing uvicorn solved the issue, Thank you Abdul. Commented Nov 1, 2022 at 12:22

1 Answer 1

2

From the traceback it seems like manage-fastapi is trying to execute some external commands. The way to execute external commands in python is using subprocess module. So searching over the manage-fastapi repository finds only two instances of subprocess call. One is,

def validate_project(cls, values: dict): try: values["username"] = subprocess.check_output( ["git", "config", "--get", "user.name"] ) values["email"] = subprocess.check_output( ["git", "config", "--get", "user.email"] ) except subprocess.CalledProcessError: ... 

And the other is

subprocess.call(["uvicorn", f"{app_file}:app", *args]) 

The former have an except clause, so even if subprocess.check_output raises an exception the except clause will silently bypass it. But the other one does not have any exception mechanism.

So I strongly believe that uvicorn dependency missing in your project, and installing this will most likely resolve the issue.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.