You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if 'Error' in stderr:
raise IOError('wkhtmltoimage reported an error:\n' + stderr)
Running the last version of wkhtmltoimage (which disables local files loading by default) I see
~$ wkhtmltoimage index.html test.jpg
Loading page (1/2)
Error: Failed loading page file:///home/angelo/index.html (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1, due to unknown error.
~$ wkhtmltoimage --load-error-handling ignore index.html test.jpg
Loading page (1/2)
Warning: Failed loading page file:///home/angelo/index.html (ignored)
Rendering (2/2)
Done
>>> options['load-error-handling'] = 'ignore'
>>> imgkit.from_string(html, 'foobar.jpg', options = options)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/imgkit/api.py", line 90, in from_string
return rtn.to_img(output_path)
File "/usr/local/lib/python3.6/dist-packages/imgkit/imgkit.py", line 240, in to_img
raise IOError('wkhtmltoimage reported an error:\n' + stderr)
OSError: wkhtmltoimage reported an error:
Loading page (1/2)
Warning: Blocked access to file
Error: Failed to load about:blank, with network status code 301 and http status code 0 - Protocol "about" is unknown
Rendering (2/2)
Done
Exit with code 1 due to network error: ProtocolUnknownError
As you can see imgkit detects the Error string in stderr and raises IOError. This is not correct and line 239 should be modified to something like this (abort is the default option while the other ones are ignore and skip)
load_error_handling_option = self.options.get('--load-error-handling', 'abort')
if 'Error' in stderr and load_error_handling_option in ('abort', ):
raise IOError('wkhtmltoimage reported an error:\n' + stderr)
The text was updated successfully, but these errors were encountered:
I think I spotted an issue that prevents the option wkhtmltoimage --load-error-handling to be properly handled by imgkit.
The issue happens here https://github.com/jarrekk/imgkit/blob/master/imgkit/imgkit.py#L239
Running the last version of wkhtmltoimage (which disables local files loading by default) I see
As you can see imgkit detects the Error string in stderr and raises IOError. This is not correct and line 239 should be modified to something like this (abort is the default option while the other ones are ignore and skip)
The text was updated successfully, but these errors were encountered: