Skip to content

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

Open
@outis

Description

@outis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions