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: invalid literal for int() with base 10: '' #37

Open
defarm opened this issue Sep 20, 2024 · 2 comments
Open

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

defarm opened this issue Sep 20, 2024 · 2 comments

Comments

@defarm
Copy link

defarm commented Sep 20, 2024

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!

@Krasjet
Copy link
Owner

Krasjet commented Sep 20, 2024

There is no page number for the line

    "6.7* THE SINGULAR VALUE DECOMPOSITION AND THE PSEUDOINVERSE" 

I probably need to add a more friendly error message.

outis added a commit to outis/pdf.tocgen that referenced this issue Nov 11, 2024
outis added a commit to outis/pdf.tocgen that referenced this issue Nov 11, 2024
outis added a commit to outis/pdf.tocgen that referenced this issue Nov 11, 2024
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

3 participants
@Krasjet @defarm and others