LifeAlgorithm / VitalSourcePrinter

Code to legally and automatically print your purchased e-books from VitalSource.com
MIT License
76 stars 24 forks source link

"Errno22 Invalid Argument" error when using 10 page code #8

Open wreckingballheart opened 7 years ago

wreckingballheart commented 7 years ago

Hello,

Firstly, thanks so much for creating this, and for doing the updated script that allows us to pick how many pages we can print. I'm running an issue with the 10 page version of the code. After the second file saves this happens:

Traceback (most recent call last):
  File "C:\Users\Anon\Downloads\VitalSourcePrinter-master\VitalSourcePrinter-master\VitalSourcePrinter.py", line 325, in NumberProcess
    pdf2Reader = PyPDF2.PdfFileReader(pdf2File)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PyPDF2\pdf.py", line 1084, in __init__
    self.read(stream)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PyPDF2\pdf.py", line 1689, in read
    stream.seek(-1, 2)
OSError: [Errno 22] Invalid argument

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Anon\Downloads\VitalSourcePrinter-master\VitalSourcePrinter-master\VitalSourcePrinter.py", line 371, in <module>
    if __name__ == "__main__": main()
  File "C:\Users\Anon\Downloads\VitalSourcePrinter-master\VitalSourcePrinter-master\VitalSourcePrinter.py", line 365, in main
    NumberProcess(2)
  File "C:\Users\Anon\Downloads\VitalSourcePrinter-master\VitalSourcePrinter-master\VitalSourcePrinter.py", line 328, in NumberProcess
    pdf2Reader = PyPDF2.PdfFileReader(pdf2File)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PyPDF2\pdf.py", line 1084, in __init__
    self.read(stream)
  File "C:\Users\Anon\AppData\Local\Programs\Python\Python36-32\lib\site-packages\PyPDF2\pdf.py", line 1689, in read
    stream.seek(-1, 2)
OSError: [Errno 22] Invalid argument

It printed the first two pages fine, and the dialogue boxes popped up as if it were printing the second batch, and then this error showed up right after the save box disappeared. The second file was saved.

Please let me know if there is any other information I can give you that might be helpful. I don't know anything about Python so I'm not sure what else you need to know.

LifeAlgorithm commented 7 years ago

Thanks for the feedback, I will look into this when I get a chance. Does the normal 2 page script work for you?

wreckingballheart commented 7 years ago

The 2 page script did work, and I printed my book using that one so this really is not a pressing issue at all. I was using the most recent version of the VitalSouce software when I tried to print.

Also, please ignore the whole "File2" stuff from the original title. I was tired and I'm an idiot and somehow missed that the new pages were added to the Ebook file each time they were printed. >.<