You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
with a valid pdf file in varibale file the folling output is produced:
Error: Unexpected range end; expected a page
number or legal keyword, here:
Exiting.
Errors encountered. No output created.
Done. Input errors, so no output created.
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
<ipython-input-71-8f19f4570272> in <module>
----> 1 next(chunk_gen)
<ipython-input-69-9da5f665d933> in gen_pdfchunks(pdf_path, chunksize, first, last)
22 args += ['output', chunk_file]
23 try:
---> 24 run_command(args)
25 except:
26 if cleanOnFail:
<ipython-input-38-64212d8798aa> in run_command(command, shell)
14 def run_command(command, shell=False):
15 ''' run a system command and yield output '''
---> 16 p = check_output(command, shell=shell)
17 return p.split(b'\n')
18
<ipython-input-38-64212d8798aa> in check_output(*popenargs, **kwargs)
9 if cmd is None:
10 cmd = popenargs[0]
---> 11 raise subprocess.CalledProcessError(retcode, cmd, output=output)
12 return output
13
CalledProcessError: Command '['/usr/bin/pdftk', '/home/pfeifer/Multimedia/Bücher@LP/Akupunktur/Praxis Akupressur - Christina Mildt.pdf', 'cat', '1', '-', '4', 'output', '/tmp/tmp32l4j3vt/chunk.pdf']' returned non-zero exit status 1.
The problem is, that the given page range for the chunks does not keep one string, e.g. with chunksize=5 this should be 1-4 instead of 1 - 4 which is what the command in the CalledProcessError line is doing.
I just started to write in Python, but like to contribute to the project. I am not 100% confident that the code would do what I want, if the error not have been raised. In order to improve the project and my skills I like to ask for suggestions to clean/improve/correct my given code and of course help in developing the desired function.
Best regards,
Sebastian
The text was updated successfully, but these errors were encountered:
I tried to write a function to create pdf_chunk files via pdftk syntax:
pdftk in.pdf cat 1-end output out.pdf
using:
Calling
with a valid pdf file in varibale
file
the folling output is produced:The problem is, that the given page range for the chunks does not keep one string, e.g. with
chunksize=5
this should be1-4
instead of1 - 4
which is what the command in theCalledProcessError
line is doing.I just started to write in Python, but like to contribute to the project. I am not 100% confident that the code would do what I want, if the error not have been raised. In order to improve the project and my skills I like to ask for suggestions to clean/improve/correct my given code and of course help in developing the desired function.
Best regards,
Sebastian
The text was updated successfully, but these errors were encountered: