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

convert_file errors with QXcbConnection: Could not connect to display #144

Closed
DandyDeveloper opened this issue Aug 31, 2017 · 4 comments
Closed

Comments

@DandyDeveloper
Copy link

DandyDeveloper commented Aug 31, 2017

I'm not sure whether this dependance is coming from Pandoc directly or wkhtmltopdf. This is a tornado app.

I have wkhtmltopdf 0.12.2.4 and pandoc 1.19.2.1

This is the convert that is failing:

pypandoc.convert_file(markdown_file, "html5", outputfile=pdf_file, format="markdown_github", extra_args=["-c " + publish_css])

Exception:

Traceback (most recent call last):
  File "/home/usr/.local/lib/python2.7/site-packages/tornado/web.py", line 1509, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "server.py", line 470, in post
    extra_args=["-c " + publish_css])
  File "/home/usr/.local/lib/python2.7/site-packages/pypandoc/__init__.py", line 140, in convert_file
    outputfile=outputfile, filters=filters)
  File "/home/usr/.local/lib/python2.7/site-packages/pypandoc/__init__.py", line 325, in _convert_input
    'Pandoc died with exitcode "%s" during conversion: %s' % (p.returncode, stderr)
RuntimeError: Pandoc died with exitcode "43" during conversion: QXcbConnection: Could not connect to display

I've tried running this with a display running Xvfb :0 & but its still failing. Any suggestions?

This seems more like a Pandoc problem though. Please close if you think this needs to be dealt with by Pandoc.

@jankatins
Copy link
Contributor

This is not pypandoc failing, but pandoc itself. The error message sounds like it is something qt related, not sure what in pandoc used QT :-(

My first ideas would be to try setting the DISPLAY env variable to something which has an xserver (e.g. export DISPLAY=:0 or os.environ['DISPLAY'] = ':0'. The second I found in ariya/phantomjs#14376 : QT_QPA_PLATFORM=offscreen

@DandyDeveloper
Copy link
Author

I actually think this is wkhtmltopdf 12.4 having the bug still. I'm trying to upgrade to 0.12.4

@DandyDeveloper
Copy link
Author

DandyDeveloper commented Aug 31, 2017

I'll leave this here for visibility if anyone has this problem in future.

You'll need to use the latest binaries from wkhtmltopdf here: https://unix.stackexchange.com/questions/192642/wkhtmltopdf-qxcbconnection-could-not-connect-to-display

I was using version 0.12.2. This is fixed in version 0.12.4.

Make sure to purge 0.12.2 if you've accidentally installed like I did!

@jankatins
Copy link
Contributor

Thanks for posting the solution!

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