Fixing Default Azure Credential bug in Windows throwing NotImplementedError #328
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request aims to solve the #270 issue about throwing NotImplementedError when trying to use anon=False in Windows.
This error occurs because asyncio.get_child_watcher is Unix only.
The workaround was:
In get_default_azure_credential, I removed the asyncio part (Windows does not have get_child_watcher implemented, this function is Unix only):
https://github.com/gabrieldaiha/adlfs/blob/223d6683e35757b25671b42dd7cfdc67df08df18/adlfs/spec.py#L531-L548
I moved the get_default_azure_credential call from do_connect function to the init function, like get_service_principal_credential does. Finally, I added a new weakref.finalize to async credentials too, in order to avoid Unclosed Client Session ERROR in the exit of the program:
https://github.com/gabrieldaiha/adlfs/blob/223d6683e35757b25671b42dd7cfdc67df08df18/adlfs/spec.py#L454-L465