- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试学习如何使用 Azure 表存储服务。我正在关注本教程:https://learn.microsoft.com/en-us/azure/storage/storage-python-how-to-use-table-storage我只是将代码复制粘贴到 jupyter 笔记本中。我已设置存储帐户并成功使用 Blob 存储。也来自笔记本。
教程中的代码:
from azure.storage.table import TableService, Entity
table_service = TableService(account_name='myaccount', account_key='mykey')
table_service.create_table('tasktable')
当我运行最后一行时,出现以下错误,我不确定我做错了什么导致它
---------------------------------------------------------------------------
Error Traceback (most recent call last)
/usr/local/lib/python3.5/site-packages/azure/storage/storageclient.py in _perform_request(self, request, parser, parser_args, operation_context)
205 _add_date_header(request)
--> 206 self.authentication.sign_request(request)
207
/usr/local/lib/python3.5/site-packages/azure/storage/_auth.py in sign_request(self, request)
96
---> 97 self._add_authorization_header(request, string_to_sign)
98
/usr/local/lib/python3.5/site-packages/azure/storage/_auth.py in _add_authorization_header(self, request, string_to_sign)
50 def _add_authorization_header(self, request, string_to_sign):
---> 51 signature = _sign_string(self.account_key, string_to_sign)
52 auth_string = 'SharedKey ' + self.account_name + ':' + signature
/usr/local/lib/python3.5/site-packages/azure/storage/_common_conversion.py in _sign_string(key, string_to_sign, key_is_base64)
87 if key_is_base64:
---> 88 key = _decode_base64_to_bytes(key)
89 else:
/usr/local/lib/python3.5/site-packages/azure/storage/_common_conversion.py in _decode_base64_to_bytes(data)
77 data = data.encode('utf-8')
---> 78 return base64.b64decode(data)
79
/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/base64.py in b64decode(s, altchars, validate)
89 raise binascii.Error('Non-base64 digit found')
---> 90 return binascii.a2b_base64(s)
91
Error: Incorrect padding
During handling of the above exception, another exception occurred:
AzureException Traceback (most recent call last)
<ipython-input-17-192b23ba629f> in <module>()
----> 1 table_service.create_table('tasktable')
/usr/local/lib/python3.5/site-packages/azure/storage/table/tableservice.py in create_table(self, table_name, fail_on_exist, timeout)
520 if not fail_on_exist:
521 try:
--> 522 self._perform_request(request)
523 return True
524 except AzureHttpError as ex:
/usr/local/lib/python3.5/site-packages/azure/storage/table/tableservice.py in _perform_request(self, request, parser, parser_args, operation_context)
1087 def _perform_request(self, request, parser=None, parser_args=None, operation_context=None):
1088 _update_storage_table_header(request)
-> 1089 return super(TableService, self)._perform_request(request, parser, parser_args, operation_context)
/usr/local/lib/python3.5/site-packages/azure/storage/storageclient.py in _perform_request(self, request, parser, parser_args, operation_context)
264 sleep(retry_interval)
265 else:
--> 266 raise ex
267 finally:
268 # If this is a location locked operation and the location is not set,
/usr/local/lib/python3.5/site-packages/azure/storage/storageclient.py in _perform_request(self, request, parser, parser_args, operation_context)
240 if sys.version_info >= (3,):
241 # Automatic chaining in Python 3 means we keep the trace
--> 242 raise AzureException(ex.args[0])
243 else:
244 # There isn't a good solution in 2 for keeping the stack trace
AzureException: Incorrect padding
最佳答案
总而言之,该问题是由于帐户 key 的变量名称出现错误而导致的。根据错误信息Error: In Correct padding
,正如@Scovetta所说,它似乎不是BASE64
编码。对键的某些更改(例如缺少最后一个 =
符号或添加更多 =
符号)将导致错误。 Azure存储的正确帐户 key 长度为88。
关于python - AzureException : Incorrect padding. 遵循 Azure 教程即可,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41691817/
我正在尝试学习如何使用 Azure 表存储服务。我正在关注本教程:https://learn.microsoft.com/en-us/azure/storage/storage-python-how-
我正在尝试使用Azure HDInsight的Hadoop。我通过 ssh 登录集群并运行以下命令 hadoop jar jar_name class_name wasb://[email prote
我正在尝试执行此命令,但在很多情况下,它都会返回此错误。 spark.sql("""如果存在则删除表 """+ L2_STAGE + """.STERLING_INCRMENT_STAGE_DELTA
我遇到了异常, shaded.databricks.org.apache.hadoop.fs.azure.AzureException:java.util.NoSuchElementException
我有一个私有(private) Azure 存储帐户并在本地使用 PySpark,我想读取 Blob。设置如下: access_key = spark = SparkSession.builder.
我遇到了异常, shaded.databricks.org.apache.hadoop.fs.azure.AzureException:java.util.NoSuchElementException
我有一个私有(private) Azure 存储帐户并在本地使用 PySpark,我想读取 Blob。设置如下: access_key = spark = SparkSession.builder.
我是一名优秀的程序员,十分优秀!