I am trying to read/write from blob storage using a Python WebJob on an Azure App Service. My App Service's requirements.txt file includes the azure-storage package name: the package is successfully installed via pip during App Service deployment. However, when I include the following in my WebJob's run.py file:
import sys
sys.path.append('D:\\home\\site\\wwwroot\\env\\Lib\\site-packages')
from azure.storage.blob import BlockBlobService
...I get the following error message at runtime:
[09/27/2016 17:51:09 > 775106: SYS INFO] Status changed to Initializing
[09/27/2016 17:51:09 > 775106: SYS INFO] Run script 'run.py' with script host - 'PythonScriptHost'
[09/27/2016 17:51:09 > 775106: SYS INFO] Status changed to Running
[09/27/2016 17:51:10 > 775106: ERR ] Traceback (most recent call last):
[09/27/2016 17:51:10 > 775106: ERR ] File "run.py", line 11, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from azure.storage.blob import BlockBlobService
[09/27/2016 17:51:10 > 775106: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\azure\storage\blob\__init__.py", line 15, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from .models import (
[09/27/2016 17:51:10 > 775106: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\azure\storage\blob\models.py", line 15, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from .._common_conversion import _to_str
[09/27/2016 17:51:10 > 775106: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\azure\storage\_common_conversion.py", line 22, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from .models import (
[09/27/2016 17:51:10 > 775106: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\azure\storage\models.py", line 23, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from ._error import (
[09/27/2016 17:51:10 > 775106: ERR ] File "D:\home\site\wwwroot\env\Lib\site-packages\azure\storage\_error.py", line 15, in <module>
[09/27/2016 17:51:10 > 775106: ERR ] from ._common_conversion import _to_str
[09/27/2016 17:51:10 > 775106: ERR ] ImportError: cannot import name '_to_str'
[09/27/2016 17:51:10 > 775106: SYS INFO] Status changed to Failed
[09/27/2016 17:51:10 > 775106: SYS ERR ] Job failed due to exit code 1
FWIW, several other packages were loaded properly using the same approach. Can anyone suggest a method to get the azure-storage package working in Python Azure WebJobs?