IOError with Python Pdfkit

469 views Asked by At

I would like to generate a pdf when a user fills out a form with django and then save it onto my file system. It seems to work just file from the python shell. But when running it after a form is filled out, I get this error on the page:

IOError wkhtmltopdf exited with non-zero code -6. error: Loading pages (1/6) QEventDispatcherUNIXPrivate(): Unable to create thread pipe: Too many open files QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe

Anyone have any idea what the issue is? The url I am downloading as a pdf is also on my server... could this be causing the issue? Thanks!

1

There are 1 answers

1
Edwin Lunando On

If you open a lot of files at once, you need to set the max limit for your machine.

ulimit -n 2048

Do not forget to close the file object after you used it.