Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError when error is a string in retry.py #630

Closed
keunhong opened this issue Jul 10, 2024 · 2 comments · Fixed by #631
Closed

AttributeError when error is a string in retry.py #630

keunhong opened this issue Jul 10, 2024 · 2 comments · Fixed by #631

Comments

@keunhong
Copy link
Contributor

It seems like in rare cases GCS returns a string in the "error" field rather than a JSON object here:

error = json.loads(content)["error"]

This causes an attribute error here:

self.message = error_response.get("message", "")

File "[...]/lib/python3.10/site-packages/gcsfs/retry.py", line 21, in __init__
    self.code = error_response.get("code", None)
AttributeError: 'str' object has no attribute 'get'

This happens very rarely and I haven't been able to log exactly what is returned by Google in this case.

@martindurant
Copy link
Member

Would you like to make a PR with an isinstance on this line?

@keunhong
Copy link
Contributor Author

Would you like to make a PR with an isinstance on this line?

Will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants