Skip to content

ValueError: invalid literal for int() with base 10: '' #37

Open
@defarm

Description

@defarm

I have a toc file for a textbook but running pdftocio linear_algebra_5th_edition.pdf < toc returns the error in the title. Here's the result with a -g flag:

df@tower:~/pdftocgen$ pdftocio -g linear_algebra_5th_edition.pdf < toc_new
Traceback (most recent call last):
  File "/home/df/.local/bin/pdftocio", line 8, in <module>
    sys.exit(main())
  File "/home/df/.local/lib/python3.10/site-packages/pdftocio/app.py", line 166, in main
    raise e
  File "/home/df/.local/lib/python3.10/site-packages/pdftocio/app.py", line 156, in main
    toc = parse_toc(toc_file)
  File "/home/df/.local/lib/python3.10/site-packages/pdftocio/tocparser.py", line 38, in parse_toc
    return list(map(parse_entry, reader))
  File "/home/df/.local/lib/python3.10/site-packages/pdftocio/tocparser.py", line 22, in parse_entry
    int(entry[indent + 1]),  # pagenum
ValueError: invalid literal for int() with base 10: ''

and here's the toc file.
toc.txt

Thanks in advance!

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