Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

returned non-zero exit status 1 #151

Open
durdenk opened this issue Aug 16, 2017 · 5 comments
Open

returned non-zero exit status 1 #151

durdenk opened this issue Aug 16, 2017 · 5 comments

Comments

@durdenk
Copy link

durdenk commented Aug 16, 2017

I think its possibly my mistake, this cannot be that wrong,

settings.py

WKHTMLTOPDF_CMD_OPTIONS = {
    'quiet': False,
    'disable-javascript': True
}
WKHTMLTOPDF_CMD = '/usr/bin/wkhtmltopdf'

Using:

class MyPDF(PDFTemplateView):
    filename = '/home/workspace/panda/test.pdf'
    template_name = 'pdf-text.html'
    cmd_options = {
        'margin-top': 3,
    }

I get:

**Command '['/usr/bin/wkhtmltopdf', u'--disable-javascript', '--encoding', u'utf8', u'--margin-top', u'3', u'--quiet', u'False', '/tmp/wkhtmltopdfWaFux9.html', '-']' returned non-zero exit status 1**

If I run this python code:

arg = ['/usr/bin/wkhtmltopdf','/tmp/wkhtmltopdfWaFux9.html','/home/workspace/test.pdf']
subprocess.check_output(arg)

I get the correct behaviour, since I got no permission or other errors doing check_output manually, is it possible that, this view calls wkhtmltopdf with wrong order?

Thanks

@eduardocasas
Copy link

I had the same problem. Try to add this to your settings.py file:

WKHTMLTOPDF_CMD = 'xvfb-run -a wkhtmltopdf'

@eersya
Copy link

eersya commented Aug 2, 2018

Could you put the code of your template? I solve my problem eliminating my style-sheets loaded from static

@jlariza
Copy link

jlariza commented Aug 3, 2018

@eduardocasas answer solved the problem for me.

@sharadm20
Copy link

xvfb-run -a wkhtmltopdf

if I add this to settings.py i get another error :

No such file or directory: 'xvfb-run'

@Goldziher
Copy link

@sharadm20

apt-get update && apt-get install -y xvfb

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants