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

Improve logging and handling of PDB writing errors. #4753

Merged
merged 6 commits into from
Jun 26, 2024

Conversation

JoaoRodrigues
Copy link
Member

  • I hereby agree to dual licence this and any previous contributions under both
    the Biopython License Agreement AND the BSD 3-Clause License.

  • I have read the CONTRIBUTING.rst file, have run pre-commit
    locally, and understand that continuous integration checks will be used to
    confirm the Biopython unit tests and style checks pass with these changes.

Closes #4729.

This PR improves our handling of failures in PDBIO. As is, if there is a failure, we print the full traceback, which can be hard to parse. More importantly, we write an incomplete/partial PDB file up to the point of failure. This PR adds the main error message on the last (bottom) traceback error message for easier debugging. In addition, we now delete or truncate the file if there is an exception, depending on if the user provided a string or an open file handle, respectively.

@peterjc
Copy link
Member

peterjc commented Jun 24, 2024

Could this ever be used with a non-seekable output handle (e.g. stdout), and in that case is it handled gracefully?

@JoaoRodrigues
Copy link
Member Author

JoaoRodrigues commented Jun 24, 2024 via email

mdehoon and others added 2 commits June 25, 2024 10:57
…size (8, expected 4) biopython#4751 (biopython#4752)

* update

* fix long dtype

* fix long dtype

* update

* update

* update

* update

* test numpy array repr

* test dtype

* try printing

* update

* update

* fix chapter_blast

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

* update

---------

Co-authored-by: Michiel de Hoon <mdehoon@tkx249.genome.gsc.riken.jp>
Co-authored-by: Michiel de Hoon <mdehoon@madpc2s-MacBook-Pro.local>
@JoaoRodrigues JoaoRodrigues removed the request for review from mdehoon June 25, 2024 15:17
@JoaoRodrigues
Copy link
Member Author

Tests passed! @peterjc, if you are ok with this, go ahead and merge 💪

@peterjc peterjc merged commit 49d2b66 into biopython:master Jun 26, 2024
32 checks passed
@peterjc
Copy link
Member

peterjc commented Jun 26, 2024

Thank you - rebased-and-merged.

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

Successfully merging this pull request may close these issues.

PDBIOException re-raised ValueError with obfuscating message
3 participants