I want to run a Python job in an Azure App Service WebJob. The App Service plan is Basic. The OS is Linux, and the runtime is Python. The deployment model is set to “Code.”
I created a WebJob by uploading a ZIP file containing a simple Python script.
However, when I run the WebJob, an error occurs. Looking at the error logs, I see messages like the following:
[11/18/2024 23:23:22 > d7204e: SYS INFO] Status changed to Initializing
[11/18/2024 23:23:22 > d7204e: SYS INFO] Run script 'run.py' with script host - 'PythonScriptHost'
[11/18/2024 23:23:22 > d7204e: SYS INFO] Status changed to Running
[11/18/2024 23:23:22 > d7204e: ERR ] An error occurred trying to start process 'python.exe' with working directory '/tmp/jobs/triggered/webjobpy/bphw5fzr.pno/webjobtest'. No such file or directory
Looking at the error message, it says that python.exe cannot be found, and I suspect that might be the issue.
I have confirmed that the OS is set to Linux.
Is there any solution for this? Or is it that Python jobs are not supported in WebJobs?
I expected the Python job to run successfully since Python should be supported in WebJobs.
python Run script 'run.py' with script host - 'PythonScriptHost' [11/18/2024 23:23:22 > d7204e: SYS INFO] Status changed to Running [11/18/2024 23:23:22 > d7204e: ERR ] An error occurred trying to start process 'python.exe' with working directory '/tmp/jobs/triggered/webjobpy/bphw5fzr.pno/webjobtest'. No such file or directory
Even I got same Error when I used run.py
as the Python file name.
The WebJobs service treated run.py
as the entry point but did not find any runnable scripts in the file, which caused an error.
I created a simple Python WebJob with a file name different from run.py
.
webjob. py:
print("Hello, world!")
script. sh:
python3 run.py
WebJob Output: