Using Python-Package in Azure WebJobs showing Eror - ImportError: DLL load failed

Using Python-Package in Azure WebJobs showing Eror - ImportError: DLL load failed

我正在使用 python script.This 创建 azure WebJobs 需要像 azure-storage-blob 和 pandas 这样的包。为了使用这些包,我按照链接 and https://lnx.azurewebsites.net/python-site-packages-in-azure-python-webjobs/.

上给出的说明进行操作

错误

[03/13/2018 05:30:00 > a941f1: SYS INFO] Status changed to Initializing [03/13/2018 05:30:02 > a941f1: SYS INFO] Job directory change detected: Job file 'some\site-packages\six.pyc' timestamp differs between source and working directories. [03/13/2018 05:30:36 > a941f1: SYS INFO] Run script 'run.cmd' with script host - 'WindowsScriptHost' [03/13/2018 05:30:36 > a941f1: SYS INFO] Status changed to Running [03/13/2018 05:30:36 > a941f1: INFO] [03/13/2018 05:30:36 > a941f1: INFO] D:\local\Temp\jobs\triggered\blobs\okznsh2a.kix\some>D:\home\Python27\python.exe blob.py [03/13/2018 05:30:38 > a941f1: ERR ] Traceback (most recent call last): [03/13/2018 05:30:38 > a941f1: ERR ] File "blob.py", line 4, in [03/13/2018 05:30:38 > a941f1: ERR ] from azure.storage.blob import BlockBlobService,ContentSettings [03/13/2018 05:30:38 > a941f1: ERR ] File "site-packages\azure\storage\blob__init__.py", line 6, in [03/13/2018 05:30:38 > a941f1: ERR ] from .appendblobservice import AppendBlobService [03/13/2018 05:30:38 > a941f1: ERR ] File "site-packages\azure\storage\blob\appendblobservice.py", line 30, in [03/13/2018 05:30:38 > a941f1: ERR ] from ._deserialization import ( [03/13/2018 05:30:38 > a941f1: ERR ] File "site-packages\azure\storage\blob_deserialization.py", line 39, in [03/13/2018 05:30:38 > a941f1: ERR ] from ._encryption import _decrypt_blob [03/13/2018 05:30:38 > a941f1: ERR ] File "site-packages\azure\storage\blob_encryption.py", line 13, in [03/13/2018 05:30:38 > a941f1: ERR ] from cryptography.hazmat.primitives.padding import PKCS7 [03/13/2018 05:30:38 > a941f1: ERR ] File "site-packages\cryptography\hazmat\primitives\padding.py", line 13, in [03/13/2018 05:30:38 > a941f1: ERR ] from cryptography.hazmat.bindings._padding import lib [03/13/2018 05:30:38

a941f1: ERR ] ImportError: DLL load failed: The specified module could not be found. [03/13/2018 05:30:38 > a941f1: SYS INFO] Status changed to Failed [03/13/2018 05:30:38 > a941f1: SYS ERR ] Job failed due to exit code 1

我在 Azure 中寻找 ImportError: DLL load failed 但我没有得到任何与此相关的令人信服的答案 problem.Most 其中与升级我用来上传的某些 package.The 文件夹相关Webjobs 有以下内容

blob.py
run.cmd
site-packages

文件

run.cmd 包含:

D:\home\Python27\python.exe blob.py

blob.py

enter code here
import sys
sys.path.append("site-packages")
from azure.storage.blob import BlockBlobService,ContentSettings
import pandas as pd
from io import StringIO
class blobfunction:
        def __init__(self,account,key):

            self.block_blob_service = BlockBlobService(account_name=account, account_key=key)

如何使用 blob.py 脚本 运行 azure Webjobs?

我自己测试了类似的代码,webjobs 很适合我。

根据您提供的路径,我可以看到您正在您的网络应用程序中安装 Python27 扩展程序。

我安装了 python 2.7.14*86 版本并通过 pip 安装了 azure-storage 包。

run.cmd:

D:\home\Python27\python.exe sample.py

sample.py:(这里不用加路径,因为依赖包默认安装在上面cmd中设置的路径)

from azure.storage.blob import BlockBlobService,ContentSettings

block_blob_service = BlockBlobService(account_name='***', account_key='***')

generator = block_blob_service.list_blobs('jay')
for blob in generator:
    print "\t Blob name: " , blob.name

运行 网络作业:

希望对你有帮助。