Python Forum
Anyone experienced with webkit2png?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anyone experienced with webkit2png?
#1
This is the confusing thing about some python packages...

The wealth of packages to assist you in reaching your goals are amazing but now and then you run into something that appears as a brick wall for something that appears to be your final link between you and success. Such is the case with webkit2png. Running the setup (python setup.py install) and not a single error in the process but there is a warning which doesn't seem to be a problem.

This package installs a command line tool to snap-shot an html page and send it to a png file.

Here is what the output of the install is...
Output:
running egg_info writing webkit2png.egg-info\PKG-INFO writing dependency_links to webkit2png.egg-info\dependency_links.txt writing top-level names to webkit2png.egg-info\top_level.txt reading manifest file 'webkit2png.egg-info\SOURCES.txt' writing manifest file 'webkit2png.egg-info\SOURCES.txt' installing library code to build\bdist.win32\egg running install_lib warning: install_lib: 'build\lib' does not exist -- no Python modules to install creating build\bdist.win32\egg creating build\bdist.win32\egg\EGG-INFO copying webkit2png.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO copying webkit2png.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO copying webkit2png.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO copying webkit2png.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO zip_safe flag not set; analyzing archive contents... creating 'dist\webkit2png-0.8.2-py3.6.egg' and adding 'build\bdist.win32\egg' to it removing 'build\bdist.win32\egg' (and everything under it) Processing webkit2png-0.8.2-py3.6.egg Removing c:\python\lib\site-packages\webkit2png-0.8.2-py3.6.egg Copying webkit2png-0.8.2-py3.6.egg to c:\python\lib\site-packages webkit2png 0.8.2 is already the active version in easy-install.pth Installed c:\python\lib\site-packages\webkit2png-0.8.2-py3.6.egg Processing dependencies for webkit2png==0.8.2 Finished processing dependencies for webkit2png==0.8.2
The only red flag I can see is the line "warning: install_lib: 'build\lib' does not exist -- no Python modules to install".

I have no idea how I'm supposed to resolve this warning. It doesn't appear to be a missing module. I went to the GITHUB page for it and see where the last bit of guidance given is to check out the help for the command line interface with "webkit2png -h" from the scripts folder, which resulted in Windows telling me that there was no webkit2png executable.

So apparently, the installer didn't complete successfully and I'm guessing that the cause of that is the warning message.

Anyone know how I can resolve this and complete a successful install of this package?
Through a cloudy window,
Kip...

“Progress means getting nearer to the place you want to be. And if you have taken a wrong turn, then to go forward does not get you any nearer.
If you are on the wrong road, progress means doing an about-turn and walking back to the right road; and in that case the man who turns back soonest is the most progressive man.” ― C.S. Lewis
Reply
#2
I expect that you may have already seen the homepage, but there are quite a few install options listed, so here's the URL in case you
haven't been here yet: https://github.com/AdamN/python-webkit2png.

The last update to this package was 5 years ago, which would concern me.
Reply
#3
It's old and not made to work in Windows.
Look as setup.py classifiers.
KipCarter Wrote:Running the setup (python setup.py install)
This is the old way rarely used anymore,now we use pip
pip install <package name>
It should be no problem to find a update version that's Cross-platform eg pyscreenshot,
or write one using Selenium which has browser.save_screenshot builtin,can also take screenshot of html element.
Quick test.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

#--| Setup
options = Options()
options.add_argument("--headless")
options.add_argument("window-size=1024,960")
browser = webdriver.Chrome(executable_path=r'C:\cmder\bin\chromedriver.exe', options=options)
#--| Parse or automation
browser.get('https://python-forum.io/Thread-Anyone-experienced-with-webkit2png')
browser.save_screenshot("screenshot.png")
browser.close()
[Image: Oi95dz.png]
Reply
#4
Before you waste a bunch of time reading this post... Just go to the next one!

(Mar-20-2020, 09:10 PM)snippsat Wrote: It should be no problem to find a update version that's Cross-platform eg pyscreenshot,
or write one using Selenium which has browser.save_screenshot builtin,can also take screenshot of html element.
Quick test.

Perfect! This is the kinda thing that I lack as a Python Greenie! Thanks snippsat.

I ran the test and it produced a full page PNG file based off of my html code. I then updated ...
options.add_argument("window-size=1024,960")
to...
options.add_argument("window-size=103,300")
so that I could focus in on just the label rendering itself and ran the code again. Was expecting that if I reduced the value of "window-size" that the image capture would reduce in size from the lower right to the upper left. However, it produced virtually a PNG file of exactly the same dimensions as the first test.

All I need to capture to the PNG is this...
[Image: 2020-03-11-5-00-31.png]

Going off to research acceptable option values for Selenium.
Through a cloudy window,
Kip...

“Progress means getting nearer to the place you want to be. And if you have taken a wrong turn, then to go forward does not get you any nearer.
If you are on the wrong road, progress means doing an about-turn and walking back to the right road; and in that case the man who turns back soonest is the most progressive man.” ― C.S. Lewis
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Project Using Python, No Skill, Idea first = Need experienced to show me the path. nefajcito 3 3,982 Apr-22-2017, 09:11 AM
Last Post: nefajcito
  How do you (experienced) do it? Raptor88 2 3,305 Mar-16-2017, 01:59 AM
Last Post: Raptor88

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020