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

"ValueError: I/O operation on closed file." when debugging from the command line #39

Open
outis opened this issue Nov 10, 2024 · 0 comments

Comments

@outis
Copy link
Contributor

outis commented Nov 10, 2024

Summary

When trying to debug pdftocio (or pdftocio) using pdb and reading the TOC from a file, pdb crashes with "ValueError: I/O operation on closed file".

Steps to reproduce

  1. create a TOC file "test.toc" (contents don't matter) and have a PDF
  2. run: python -m pdb ${bindir}/pdftocio -t test.toc in.pdf
  3. from pdb, type c

Cause

By default, the toc file is opened from sys.stdin.buffer. If a file is set with -t, stdin gets closed. pdb then tries to read from stdin to get the next command, causing the exception.

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

No branches or pull requests

1 participant