I am using imgkit and xvfb and getting the below error and can't find solution to it.
Traceback (most recent call last):
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/vyral/vyral-env/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/vyral/mysite/vyral-flask/twee.py", line 170, in get_img
ima = generate_tweet(tweet, tweet_author_name, tweet_author_id, tweet_author_dp, tweet_body, tweet_time)
File "/home/vyral/mysite/vyral-flask/twee.py", line 146, in generate_tweet
ima = imgkit.from_string(tweet, False, options = options, config=config)
File "/home/vyral/vyral-env/lib/python3.8/site-packages/imgkit/api.py", line 90, in from_string
return rtn.to_img(output_path)
File "/home/vyral/vyral-env/lib/python3.8/site-packages/imgkit/imgkit.py", line 246, in to_img
raise IOError("wkhtmltoimage exited with non-zero code {0}. error:\n{1}\n\n{2}".format(exit_code, stderr, xvfb_error))
OSError: wkhtmltoimage exited with non-zero code -6. error:
QXcbConnection: Could not connect to display
**NO MATCH**
**NO MATCH**
You need to install xvfb(sudo apt-get install xvfb, yum install xorg-x11-server-Xvfb, etc), then add option: {"xvfb": ""}.
[edit by admin: formatting]