zipfile中的Webjobs运行错误(3587fd:ERR) [英] Webjobs Running Error (3587fd: ERR ) from zipfile
问题描述
我在一个名为 fgh.py
的文件中有以下小脚本,我一直试图将其安排为网络作业
将pandas导入为pddf = pd.DataFrame({'a':[1,2,2],'b':[5,6,9]})df ['x'] = df.a.sub(df.b)打印(df)
使用@Peter Pan
另外从 https://arcgistrial.scm.azurewebsites.net/DebugConsole
运行cmd命令 python -V
时,我得到以下信息
在我的 run.bat
文件中,我尝试使用上面的任何一个目录都没有成功.
是否将我的 run.bat
文件制作为 D:\ home \ python364x64 \ python.exe fgh.py
或 D:python364x64 \ python.exe fgh.py
我收到以下错误;
我已经大胆地安装了 pandas
,并通过尝试安装 numpy
来检查是否成功
所有这些都无济于事.我已经处理了几天,它必须以某种方式工作.有帮助吗?
(在旧的Webjobs中,运行带有依赖项的python任务并不是一件很简单的事情.已经有一段时间了,世界已经转移到
- 创建一个
requirements.txt
文件,其中包含pandas
和numpy
(请注意,由于- 为网络作业上传zip.
- 执行任务:)
忽略错误"ModuleNotFoundError:没有名为"certifi"的模块",不需要.
I have the following small script in a file named
fgh.py
which I have been attempting to schedule as a webjobimport pandas as pd df=pd.DataFrame({'a':[1,2,2],'b':[5,6,9]}) df['x']=df.a.sub(df.b) print(df)
Using @Peter Pan post. I have created a virtual environment, done a
pip install pandas
. From the virtual environment, the script runs and executes as required.It however does not execute when loaded inAzure Webjobs
. I suspect issues arise from the interface between the run,bat file and the Azure python console but have limited understanding of Azure to resolve the issueIn kudus, I have used this post to install python.
Running
where python
incmd
command inhttps://myapp.scm.azurewebsites.net/DebugConsole
I get;Additionally from
https://arcgistrial.scm.azurewebsites.net/DebugConsole
I get the following when I run cmd commandpython -V
In my
run.bat
file, I have tried to use either of the directories above without success.Whether I make my
run.bat
fileD:\home\python364x64\python.exe fgh.py
orD:python364x64\python.exe fgh.py
I get the following error;I have gone a head and installed
pandas
and checked if successful by trying to installnumpy
All this has not helped. I have been on this for a couple of days and it has to work somehow. Any help?
解决方案(Things are not quite straightforward in old Webjobs to run python task with dependencies. It has been quite some time, the world has moved on to Azure Function :))
However, since you still need to stick to Webjobs, below are the steps I followed which worked. I am using a batch file (.cmd) to run the python script due to the pre-requisites.
- By default webjob supports python 2.7 at this moment. So, add python3 from 'extension' in your web app, In this case it was 3.6.4 x64 for me. This will add in path
D:\home\python364x64\
. How did I know? Kudus console :)
- Create a
requirements.txt
file which containspandas
andnumpy
(note I had to explicitly add numpy version 1.19.3 due to an issue with latest 1.19.4 in Windows host at the time of this writing). Basically I used yourfgh.py
which depends onpandas
which in turn depends onnumpy
.
pandas==1.1.4 numpy==1.19.3
- Create a
run.cmd
file having the following content. Note 1st line is not needed. I was just checking python version.
D:\home\python364x64\python --version D:\home\python364x64\python -m pip install --user --upgrade pip D:\home\python364x64\python -m pip install --user certifi D:\home\python364x64\python -m pip install --user virtualenv D:\home\python364x64\python -m virtualenv .venv .venv\Scripts\pip install -r requirements.txt .venv\Scripts\python fgh.py
- Zip
fgh.py
,run.bat
and therequirements.txt
files into a single zip. Below is the content of my zip.
- Upload the zip for the webjob.
- Run the job :)
Ignore the error "ModuleNotFoundError: No module named 'certifi'", not needed.
这篇关于zipfile中的Webjobs运行错误(3587fd:ERR)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!