I'm trying to run a python azure function locally using VSCode but it keeps shutting itself down almost immediately.
I have created the simplest example function following the tutorial but I believe I have some configuration wrong on my machine.
Almost immediately after starting the function I see the following
[9/1/2019 4:52:07 PM] Found the following functions:
[9/1/2019 4:52:07 PM] Host.Functions.HttpTriggerTest
[9/1/2019 4:52:07 PM]
[9/1/2019 4:52:07 PM] Host initialized (573ms)
[9/1/2019 4:52:07 PM] Host started (590ms)
[9/1/2019 4:52:07 PM] Job host started
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] Starting language worker process:python C:\Users\First Last\.vscode\extensions\ms-python.python-2019.3.6558\pythonFiles\ptvsd_launcher.py --default --host 127.0.0.1 --port 9091 --wait "C:\Users\First
Last\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\workers\python\worker.py" --host 127.0.0.1 --port 64975 --workerId e9dc059f-128f-4e11-8363-797b4f1eeb1b --requestId c857107a-6b99-4d5a-9b71-d27827bfcad3 --grpcMaxMessageLength 134217728
[9/1/2019 4:52:07 PM] python process with Id=20920 started
Hosting environment: Production
Content root path: C:\file_location\Dev\PythonDev\MyAzureFunctions
Now listening on: http://0.0.0.0:7071
Application started. Press Ctrl+C to shut down.
Http Functions:
HttpTriggerTest: [GET,POST] http://localhost:7071/api/HttpTriggerTest
[9/1/2019 4:52:07 PM] python: can't open file 'C:\Users\First': [Errno 2] No such file or directory
[9/1/2019 4:52:07 PM] Exceeded language worker restart retry count for runtime:python. Shutting down Functions Host
[9/1/2019 4:52:07 PM] Stopping host...
[9/1/2019 4:52:07 PM] Stopping JobHost
[9/1/2019 4:52:07 PM] Job host stopped
[9/1/2019 4:52:07 PM] Host shutdown completed.
Application is shutting down...
Note: the error messages call out that the file C:\\Users\\First can't be opened because it does not exist. It is true that it does not exist. What does exist is a folder called "C:\\Users\\First Last". Perhaps the space in my windows User Name is causing an issue?
This was a problem earlie with older versions of python
.
What version of python are you using ?
If you are using anything less than 3.6.8
you will have to uninstall the old version and download the latest one from here
What version of azure-functions-core-tools
are you using ?
Even after installing latest version of python,if your problem is'nt solved -> Try uninstalling this as well, and then reboot
your machine - > then do npm install -g azure-functions-core-tools
Even if that did'nt work, temporarily disable Windows Defender real-time scans .
Actually it's because you put directory in single quote ''
, you need to put them in double quotes ""
. ie "C:\\Program Files\\Python 3.4\\python.exe"
If this is not the key problem, please share some your code causing the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.