Skip to content

AttributeError: 'dict' object has no attribute 'iter' #15956

Closed

Description

  • Package Name: azure-storage-file-datalake
  • Package Version: 12.2.0
  • Operating System: Linux
  • Python Version: 3.5.2 (from HDInsight cluster with ESP)

Describe the bug
When listing an Azure directory which doesn't have proper permission, we get AttributeError. Traceback:

Traceback (most recent call last):
  File "azure.whl/azure/storage/filedatalake/_list_paths_helper.py", line 56, in _get_next_cb
  File "azure.whl/azure/storage/filedatalake/_generated/operations/_file_system_operations.py", line 442, in list_paths
azure.storage.filedatalake._generated.models._models_py3.StorageErrorException: (AuthorizationPermissionMismatch) This request is not authorized to perform this operation using this permission.
RequestId:e6038639-e01f-007e-5013-df0d71000000
Time:2020-12-31T01:21:21.9445915Z

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_client.py", line 18, in <module>
    for run_result in fs_client.get_paths(path='rtgasi/negotiation/hdfs_rfe_v1/results/205ba9c9-8cdb-4f77-887f-c561e2c8edc3', recursive=False):
  File "azure.whl/azure/core/paging.py", line 129, in __next__
  File "azure.whl/azure/core/paging.py", line 76, in __next__
  File "azure.whl/azure/storage/filedatalake/_list_paths_helper.py", line 58, in _get_next_cb
  File "azure.whl/azure/storage/filedatalake/_shared/response_handlers.py", line 94, in process_storage_error
AttributeError: 'dict' object has no attribute 'iter'

To Reproduce
Steps to reproduce the behavior:

  1. Just run the following code where some/path does not have the proper permission:
credential = identity.ClientSecretCredential('xx', 'xx', 'xx')
service_client = filedatalake.DataLakeServiceClient('https://xx.dfs.core.windows.net', credential=credential)
fs_client = service_client.get_file_system_client(file_system='xx')
for result in fs_client.get_paths(path='some/path', recursive=False):
  pass

Expected behavior
Should raise StorageErrorException or other more relevant errors

From the look of the exception, we just need to remove .iter() part and it should work for both Python 2 and 3:

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

ClientThis issue points to a problem in the data-plane of the library.StorageStorage Service (Queues, Blobs, Files)bugThis issue requires a change to an existing behavior in the product in order to be resolved.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-author-feedbackWorkflow: More information is needed from author to address the issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions