AzureBlobFileSystem returns UnicodeError: Label too long
See original GitHub issueWhen instantiating an AzureBlobFileSystem only with account, container and sas_token. I receive an codec error when trying to basically run ls in the container.
What happened:
Traceback (most recent call last):
File "C:\Users\bbk63\Anaconda3\lib\encodings\idna.py", line 167, in encode
raise UnicodeError("label too long")
UnicodeError: label too long
...
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label too long)
What you expected to happen: Returns a list of path inside the container
Minimal Complete Verifiable Example:
abfs = AzureBlobFileSystem(account_name=ACCOUNT_NAME, sas_token=sas_token, container_name=CONTAINER_NAME)
abfs.ls('*')
Environment:
- Dask version: 2021.2.0
- Python version: 3.6
- Operating System: Windows 10 Enterprise
- Install method (conda, pip, source): pip
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10
Top Results From Across the Web
"encoding with 'idna' codec failed (UnicodeError: label too ...
Your issue was caused by your incorrect code block_blob_service = BlockBlobService(connection_string) . According to the constructor ...
Read more >Failed to run az acr check-health after login failure against ML ...
Describe the bug Command Name az acr check-health Errors: encoding with 'idna' codec failed (UnicodeError: label empty or too long) ...
Read more >Bug #1032863 “UnicodeError:"label empty or too long"
An internal server error has occurred. This most likely means that you have found a bug in SchoolTool. Please report it on the...
Read more >encoding with 'idna' codec failed (UnicodeError: label empty or...
Bug 1279614 - UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long). Summary: UnicodeError: encoding with ...
Read more >socket module calls with long host names can fail with idna ...
gethostbyname(hostonly) UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long) The error can be consistently ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks.
adfs completes the URI by appending the sas token to the account url, which highlights a shortcoming in the approach.
Currently, the user passes ACCOUNT_NAME, and the token would be created as:
https://{self.account_name}.blob.core.windows.net + sas_token
But it needs to conform to:
https://{self.account_name}.blob.core.windows.net + "/" + {container_name} + "/" + {blob} + "?" + sas_token
The most straight solution would be to allow the end-user to create and pass the full URI (with SAS) and passed to it to adlfs, requiring account_name to be None.
Thoughts?
I’ve added a check for the leading “?” in the sas_token, as mentioned above.