1
votes

I am working on Creating azure WebJobs using the python script.This requires package like azure-storage-blob and pandas. In order to use the packages, I followed the instruction given on the links Python libraries on Web Job and https://lnx.azurewebsites.net/python-site-packages-in-azure-python-webjobs/.

Error

[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

I looked for ImportError: DLL load failed in Azure but I did not get any convincing answer associated with this problem.Most of them associated with upgrading some package.The folder that I am using to upload for the Webjobs has the following things

blob.py
run.cmd
site-packages

Files

run.cmd contains:

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)

How do I run the azure Webjobs using the blob.py script?

1
Hi,any progress now?Jay Gong

1 Answers

2
votes

I tested similar code on my side and the webjobs works well for me.

Depending on the path you provide, I can see that you are installing the Python27 extension in your webapp.

I installed python 2.7.14*86 version and installed azure-storage package via pip.

enter image description here

run.cmd:

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

sample.py:(There is no need to add a path here because the dependent packages are installed in the default path which set in the above 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

Run the webjob:

enter image description here

Hope it helps you.