admin管理员组

文章数量:1122832

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.

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.

Share Improve this question edited Nov 22, 2024 at 0:08 okake asked Nov 21, 2024 at 23:32 okakeokake 32 bronze badges 4
  • Use this #!/usr/bin/env python3 at top of the run.py. – Aslesha Kantamsetti Commented Nov 22, 2024 at 0:34
  • Thank you. I added #!/usr/bin/env python3 at the top of run.py and tried running it, but I’m still getting the same error. I feel it’s strange that the OS is Linux, yet the error says, “start process with ‘python.exe’”. – okake Commented Nov 22, 2024 at 2:15
  • Provide code what you have tried? – Aslesha Kantamsetti Commented Nov 22, 2024 at 2:31
  • The error is related to your file name run.py, try to change it to a different name. – Aslesha Kantamsetti Commented Nov 22, 2024 at 7:19
Add a comment  | 

2 Answers 2

Reset to default 0

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:

Thanks for letting us know, we recently added support for WebJobs in Linux and it is in Preview at the moment.

We will make sure the 'PythonScriptHost' works well for GA.

本文标签: How to Resolve Errors When Running Python Jobs in Azure App Service WebJobsStack Overflow