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

provide more informative error message for failed open #1357

Merged

Conversation

braingram
Copy link
Contributor

The use of atomic file produces filenames that can contain random characters. Fix the filename the error message prior to raising.

Without this PR

import asdf
asdf.generic_io.get_file('missing/foo', 'w')

produces

FileNotFoundError: [Errno 2] No such file or directory: '/.../asdf/missing/.___atomic_writekdbtzq1a'

With this PR it produces

FileNotFoundError: [Errno 2] No such file or directory: 'missing/foo'

@braingram braingram marked this pull request as ready for review February 9, 2023 18:31
@braingram braingram requested a review from a team as a code owner February 9, 2023 18:31
@braingram braingram added this to the 2.15 milestone Feb 10, 2023
Copy link
Contributor

@eslavich eslavich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much improved!

The use of atomic file produces filenames that can contain
random characters. Fix the filename the error message prior
to raising.
@braingram braingram force-pushed the feature/generic_io_fail_filename branch from 572a077 to 5a06a60 Compare February 13, 2023 14:39
@braingram braingram merged commit dd679e9 into asdf-format:master Feb 13, 2023
@braingram braingram deleted the feature/generic_io_fail_filename branch February 13, 2023 14:53
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 this pull request may close these issues.

2 participants