简体   繁体   English

无法通过Python WebJob中的azure-storage包访问blob存储

[英]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.

相关问题 Azure blob 存储 model 访问 python 中的 gensim - Azure blob storage model access for gensim in python Python 代码通过 azure 自动化运行手册连接 azure blob 存储 - Python code to connect azure blob storage via azure automation runbook 如何通过socks 代理访问Azure blob 存储? - How do I access Azure blob storage via a socks proxy? Azure 通过 Python API - 设置存储帐户属性 - 允许 blob 公共访问禁用 - Azure via Python API - Set Storage Account Property - Allow blob public access To Disabled 通过python API列出azure blob存储中的虚拟文件夹 - list virtual folders in azure blob storage via python API 如何通过 Python 中的 URL 下载 Azure Blob 存储文件? - How to download an Azure Blob Storage file via URL in Python? Azure Blob 存储错误无法解析 spark 中的日期 - Azure Blob storage error can't parse a date in spark 无法使用python创建Azure存储容器 - Can't create azure storage container with python 为什么 ContentSettings cache_control max-age 没有通过 Python 在 Azure 存储 blob 中得到尊重? - Why isn't ContentSettings cache_control max-age being honored in Azure storage blob via Python? 不要在Raspberry PI-3终端中安装azure-storage命令 - Not install azure-storage command in Raspberry PI-3 terminal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM