-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
Getting OSError in s3 when permission for kms:Decrypt are missing #778
Comments
btw, the same happens with "NoSuchKey":
|
you can isolate specific errors as follows: try:
your_open_fn(key)
except OSError as exc:
msg = str(exc)
if 'PermissionDenied' in msg:
# special handling
else:
raise # default handling |
thanks @ddelange, that's what I'm doing currently - but it isn't a very "pythonic" way. |
smart_open uses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem description
Be sure your description clearly answers the following questions:
Steps/code to reproduce the problem
In order for us to be able to solve your problem, we have to be able to reproduce it on our end.
Without reproducing the problem, it is unlikely that we'll be able to help you.
Include full tracebacks, logs and datasets if necessary.
Please keep the examples minimal (minimal reproducible example).
In AWS S3, when attempting to access an object for which one lacks "kms:Decrypt" permissions, instead of receiving the expected indicative exception type, a general OSError is encountered. This circumstance makes it challenging to effectively catch and identify this particular type of error.
Traceback:
I suspect that this is the relevant area:
![image](https://private-user-images.githubusercontent.com/96263702/260309701-71940524-c8a6-4334-ae8f-7862e2f6469f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ1MDMzOTUsIm5iZiI6MTcyNDUwMzA5NSwicGF0aCI6Ii85NjI2MzcwMi8yNjAzMDk3MDEtNzE5NDA1MjQtYzhhNi00MzM0LWFlOGYtNzg2MmUyZjY0NjlmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDEyMzgxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI1NDFiMzcxMzU2NDlhMWNiOWFhMTJkYjQ4OGM1NzJkN2M3NGYyYjVjOWJhODYxMzc1M2Q5Y2I1NmZkMGU0YWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Zb0I4sLm7d1XaxZBlOny9qnDiUe_2Dy6s9b_AUK0lvI)
Versions
Please provide the output of:
Checklist
Before you create the issue, please make sure you have:
The text was updated successfully, but these errors were encountered: