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

Failed on long list of html input #33

Closed
kakyoism opened this issue Jul 6, 2015 · 1 comment
Closed

Failed on long list of html input #33

kakyoism opened this issue Jul 6, 2015 · 1 comment

Comments

@kakyoism
Copy link

kakyoism commented Jul 6, 2015

I'm on Mac OS X 10.10.3 with py2.7.6.

I have a folder of 3,000+ html files and pdfkit failed when I run:
pdfkit.from_file(myHtmls, 'out.pdf')

the traceback:


OSError Traceback (most recent call last)
in ()
----> 1 pdfkit.from_file(htmls, '/Users/kakyo/Desktop/out.pdf')

/Library/Python/2.7/site-packages/pdfkit/api.pyc in from_file(input, output_path, options, toc, cover, css, configuration)
44 configuration=configuration)
45
---> 46 return r.to_pdf(output_path)
47
48

/Library/Python/2.7/site-packages/pdfkit/pdfkit.pyc in to_pdf(self, path)
91
92 result = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
---> 93 stderr=subprocess.PIPE)
94
95 # If the source is a string then we will pipe it into wkhtmltopdf.

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
707 p2cread, p2cwrite,
708 c2pread, c2pwrite,
--> 709 errread, errwrite)
710 except Exception:
711 # Preserve original exception in case os.close raises.

/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
1324 raise
1325 child_exception = pickle.loads(data)
-> 1326 raise child_exception
1327
1328

OSError: [Errno 7] Argument list too long

It is probably because that pdfkit tried to pipe the long list of file paths as arguments to wkhtmltopdf. This apparently broke the pipe.

I wonder if there is a file-list file option is available for wkhtmltopdf, so that it accept a single file-list file that contains a list of input html file paths.

@JazzCore
Copy link
Owner

Closing due to date, feel free to reopen if you need ping me about this issue.

Sorry that it took so long for me to get to it...

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

2 participants