Environment I am currently working:
This is my example.py
import os
import imgkit
imgkit.from_url('http://google.com', 'C:\out.jpg')
As this code clearly shows that I am trying to take the screenshot of the google website. But when I run this code in Windows 10 platform what I got, this errors.
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\testdns.py", line 3, in <module>
imgkit.from_url('http://google.com', 'C:\out.jpg')
File "C:\Python27\lib\site-packages\imgkit\api.py", line 32, in from_url
return rtn.to_img(output_path)
File "C:\Python27\lib\site-packages\imgkit\imgkit.py", line 240, in to_img
raise IOError('wkhtmltoimage reported an error:\n' + stderr)
IOError: wkhtmltoimage reported an error:
Loading page (1/2)
Rendering (2/2)
Error: Could not write to output file
Error: Could not save image
Done
Exit with code 1, due to unknown error.
Now I don't know how to proceed
Try this:
imgkit.from_url('http://google.com', 'out.jpg')
The above code will save image in root directory of the script. Or you can change out.jpg
to any folder to which you have access like Documents Folder or Pictures Folder.