[英]Can't access blob storage via azure-storage package in Python WebJob
I am trying to read/write from blob storage using a Python WebJob on an Azure App Service. 我正在尝试使用Azure App Service上的Python WebJob从blob存储读取/写入。 My App Service's requirements.txt file includes the azure-storage package name: the package is successfully installed via pip during App Service deployment. 我的App Service的requirements.txt文件包含azure-storage软件包名称:该软件包在App Service部署期间已通过pip成功安装。 However, when I include the following in my WebJob's run.py file: 但是,当我在WebJob的run.py文件中包含以下内容时:
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. FWIW,使用相同的方法正确加载了其他几个软件包。 Can anyone suggest a method to get the azure-storage package working in Python Azure WebJobs? 谁能建议一种使Azure存储软件包在Python Azure WebJobs中工作的方法吗?
Looks like six module is missing. 好像缺少六个模块。 This issue is also tracked via this thread: https://github.com/Azure/azure-storage-python/issues/22 . 也可以通过以下线程跟踪此问题: https : //github.com/Azure/azure-storage-python/issues/22 。 You can fix issue by adding the six module to requirements.txt or manually installing six module by pip install six. 您可以通过将六个模块添加到requirements.txt或通过pip install 6手动安装六个模块来解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.