Coder Social home page Coder Social logo

python-webkit2png's People

Contributors

adamn avatar btoews avatar deisss avatar goosemo avatar itsnauman avatar jasoncodes avatar khamidou avatar kinkerl avatar larsmichelsen avatar lxfontes avatar marcon2 avatar mariuz avatar markchalloner avatar metagriffin avatar michaeljones avatar sssbox avatar troelskn avatar troszok avatar ventura avatar zigazou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-webkit2png's Issues

Run profile to get authentified on specific pages

I would need to go through authentication for some specific captures. Indeed, on some documents / web pages, I need to be identified to view the document:

Some examples

  • Google Sheet document
  • Dashboard provided by an intranet portal
  • etc.

Is it possible to

  • embed a chrome profile to retrieve cookies for pre-authentication for example
  • make a sequence of pages

Error while generating Screenshot

Here is the command I am trying to run to generate screenshot, and it is throwing some strange errors

deploy:~$ DISPLAY=:99.0 webkit2png http://www.google.com -x 500 250
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/webkit2png/scripts.py", line 203, in __main_qt
TypeError: render_to_file() got an unexpected keyword argument 'url'

It throws the same error even after running the following command

deploy:~$ xvfb-run --server-args="-screen 0 1024x768x24" python /usr/local/bin/webkit2png -o google.png http://www.google.com/
Traceback (most recent call last):
  File "build/bdist.linux-x86_64/egg/webkit2png/scripts.py", line 203, in __main_qt
TypeError: render_to_file() got an unexpected keyword argument 'url'

Any ideas, what I may be doing wrong ?

package directory 'webkit2png' does not exist

I am trying to install using "Manual installation via Git" but getting this error

python python-webkit2png/setup.py install

running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating webkit2png.egg-info
writing webkit2png.egg-info/PKG-INFO
writing top-level names to webkit2png.egg-info/top_level.txt
writing dependency_links to webkit2png.egg-info/dependency_links.txt
writing entry points to webkit2png.egg-info/entry_points.txt
writing manifest file 'webkit2png.egg-info/SOURCES.txt'
warning: manifest_maker: standard file 'setup.py' not found

error: package directory 'webkit2png' does not exist

Can somebody help me to install it ?

Project status?

Latest code changes are from 2 years ago, latest update on pypi is 7 years ago and broken since then, open PRs fixing issues do not get any feedback or get merged, issues do not get answers from the project owner.

So, is there hope that this project will be maintained in the future? Would it help if there are more contributions (reviews on PRs etc)?

setup.py install not working

Following the "Manual installation via Git" instructions, the last step:

Install with: python python-webkit2png/setup.py install

returns:

sudo python python-webkit2png/setup.py install
running install
running bdist_egg
running egg_info
writing webkit2png.egg-info/PKG-INFO
writing top-level names to webkit2png.egg-info/top_level.txt
writing dependency_links to webkit2png.egg-info/dependency_links.txt
writing entry points to webkit2png.egg-info/entry_points.txt
warning: manifest_maker: standard file 'setup.py' not found

error: package directory 'webkit2png' does not exist

If I cd into the directory and run setup from there it works.

Segmentation fault on Ubuntu 14.04 LTS with the javascript feature enabled.

When running the following command

xvfb-run --auto-servernum --server-num=1 /usr/local/bin/webkit2png -t 5  "http://www.weather.com/news/weather/video/more-wintry-precip-for-south" -o test.png -g 1200 1200 -F javascript
Segmentation fault (core dumped)

in /var/log/syslog I get the following error

kernel: [211586.457640] traps: webkit2png[31828] general protection ip:7f6425260787 sp:7fff1e51fb80 error:0 in libQtWebKit.so.4.10.2[7f6423d81000+1fc9000]

apparent problem with argument parsing - "-x" (success) vs "--xvfb" (failure)

tl;dr -- "-x" works, "--xvfb" doesn't.

If I instantiate using:
./webkit2png.py --debug --log=arse.log --xvfb=1024 768 http://example.com

the resulting xvfb run command is repeating instantations of xvfb-run strings:
DEBUG:webkit2png:Executing xvfb-run --auto-servernum --server-num 1014620 --server-args=-screen 0, 1024x768x24 ./webkit2png.py --debug --log=arse.log --xvfb=1024 768 http://example.com

DEBUG:webkit2png:Executing xvfb-run --auto-servernum --server-num 1014690 --server-args=-screen 0, 1024x768x24 ./webkit2png.py --debug --log=arse.log --xvfb=1024 768 http://example.com

This repeating call never ends, and the PNG is never produced.

Whereas if I run the command:
./webkit2png.py --debug --log=arse.log -x 1024 768 http://example.com

then the command that is run is:
DEBUG:webkit2png:Executing xvfb-run --auto-servernum --server-num 1013165 --server-args=-screen 0, 1024x768x24 ./webkit2png.py --debug --log=arse.log http://example.com
DEBUG:webkit2png:Version 20091224, Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3], Qt 4.6.2
DEBUG:webkit2png:loading started
DEBUG:webkit2png:loading finished with result True
DEBUG:webkit2png:Processing result
DEBUG:webkit2png:contentsSize: PyQt4.QtCore.QSize(1020, 700)

And the PNG is produced - and all is well.

Looking at the code (I'm not a pythonist myself) - i suspect some issue around line 443 of the current version:
elif sys.argv[i] in ["-x", "--xvfb"]:

My rationale is that the bare "-x" is followed by a space and the integer:
-x 640 480

whereas the "--xvfb" is followed by an equals sign then immediately the integer:
--xvfb=640 480

So maybe it's not parsing it out as desired.

G

Segmentation faults and other problems on repeat use

I've written a little snippet like you suggested in another thread. It's a method on a Django model class. I'm on the latest Ubuntu. (FWIW, it would be very helpful to see an example of how someone could script your excellent module to loop through a dozen urls and snap them all.)

    def get_screenshot(self):
        print "Getting screenshot for %s" % self
        # fire it up
        app = init_qtgui()
        renderer = WebkitRenderer()
        renderer.format = 'png'
        # set the path
        path = os.path.join(settings.SCREENSHOT_PATH, '%s.png' % self.slug)
        # save it
        out = open(path, "w")
        renderer.render_to_file(self.url, out)
        out.close()

It works fine when I run it once. Or every once in a while. But if I run it repeatedly I start to get bizarre segmentation faults and long trackbacks like this guy describes with a different PyQt app.

http://stackoverflow.com/questions/5923845/how-do-i-shut-down-pyqts-qtapplication-correctly

Here's an example:

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_container_add: assertion `GTK_IS_CONTAINER (container)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed

(:21953): Gtk-CRITICAL **: IA__gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed
Application asked to unregister timer 0xb000003 which is not registered in this thread. Fix application.
QObject::connect: Cannot connect (null)::configurationAdded(QNetworkConfiguration) to QNetworkConfigurationManager::configurationAdded(QNetworkConfiguration)
QObject::connect: Cannot connect (null)::configurationRemoved(QNetworkConfiguration) to QNetworkConfigurationManager::configurationRemoved(QNetworkConfiguration)
QObject::connect: Cannot connect (null)::configurationUpdateComplete() to QNetworkConfigurationManager::updateCompleted()
QObject::connect: Cannot connect (null)::onlineStateChanged(bool) to QNetworkConfigurationManager::onlineStateChanged(bool)
QObject::connect: Cannot connect (null)::configurationChanged(QNetworkConfiguration) to QNetworkConfigurationManager::configurationChanged(QNetworkConfiguration)

failure to load on Debian Lenny

I am having the same exact issue this guy is having:
http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/#comment-922

I can use the webkit2png-simple.py script, but web2png.py is failing on all pages for me. I am also using Debian Lenny, and I suspected it may be something to do with the way Qt4 installs under aptitude, but I couldn't get it working with source compiles either.

sudo ./webkit2png.py -x -g 200 200 -o google.png -t 30 'http://www.google.com/'

Roland's suggestion (http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/#comment-934) makes the script hang indefinitely. I've tried modifying the script myself, but I have only come up with blank renders, "failure to load" messages, or indefinite hanging.

webkit2png.log says:
ERROR:root:Failed to load http://www.google.com/

special character in url manipulation

In the reference of QUrl(), it reads: % will be changed to %25... Then if the $url has %20 in it, it will be translate to %2520.. which is very confused.
Any way to prevent this?

Can't get webkit2png to work on Manjaro

Hi!

I know this project is not maintained, but maybe someone would be able to help me.

I've installed webkit2png from AUR, but whe nI run it I get this:

$ webkit2png --help
Traceback (most recent call last):
  File "/usr/bin/webkit2png", line 11, in <module>
    load_entry_point('webkit2png==0.8.3', 'console_scripts', 'webkit2png')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/webkit2png/__init__.py", line 1, in <module>
    from webkit2png import WebkitRenderer
  File "/usr/lib/python2.7/site-packages/webkit2png/webkit2png.py", line 31, in <module>
    from PyQt4.QtWebKit import *
ImportError: No module named QtWebKit

I have qtwebkit installed, and even pyqt4 bindings for Python 2 and Python 3.
Still no go.

Is there any alternative I could use to produce high-resolution PNG images of websites?

X server

webkit2png run and I get the following :

webkit2png: cannot connect to X server.

you need to have a window manager running?

App Transport Security

Hi,

For getting screenshots of certain web pages with a following command;

webkit2png https://forecast.io/#/f/40.4344,-80.0248 -D ~/Desktop

then, I get this message,

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure.
Temporary exceptions can be configured via your app's Info.plist file.

To get around this, which apps' info.plist do I have to change ? I am using OS X 10.11.1

Thanks in advance.

SSL client certificate

Is it somehow possible to define a SSL client certificate (e.g. pfx format) which is necessary to open the URL?

Doesn't actually install webkit2png.py script when installing with pip

Installing version 0.8.2 doesn't seem to install the webkit2png.py script (or any actual code, for that manner):

abeld@carbon:0:~$ virtualenv test
New python executable in test/bin/python
Installing setuptools, pip...done.
abeld@carbon:0:~$ source env/bin/activate
bash: env/bin/activate: No such file or directory
abeld@carbon:1:~$ source test/bin/activate
(test)abeld@carbon:0:~$ pip install webkit2png
Downloading/unpacking webkit2png
  Using download cache from /home/abeld/.pip_download_cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fw%2Fwebkit2png%2Fwebkit2png-0.8.2.tar.gz
  Running setup.py (path:/home/abeld/test/build/webkit2png/setup.py) egg_info for package webkit2png

Installing collected packages: webkit2png
  Running setup.py install for webkit2png

Successfully installed webkit2png
Cleaning up...
(test)abeld@carbon:0:~$ ls -R test | grep webkit
webkit2png-0.8.2-py2.7.egg-info
test/lib/python2.7/site-packages/webkit2png-0.8.2-py2.7.egg-info:
(test)abeld@carbon:0:~$ 

Error: cannot connect to X server

Hi, i installed the script properly (oh well, i guess…) and i can run it and see -help. but when i try to get a screenshot from a webpage, i get this error: "webkit2png: cannot connect to X server"…

any help? : /

Capture is not only of QT/Bowser Window

First thanks very much for the code!!! Works great for single/manual captures but....

I am executing the code on OSX Yosemite.
If I force focus to the python-QT app by clicking its window BEFORE the "screen shot" is captured it works perfectly BUT if I simply launch the webkit2png script from my terminal app and DO NOT force focus to python-QT, the terminal app (currently in the foreground) is actually included as part of the generated screen capture.

This prevents me from using the app in an automated fashion to capture a list of URLs. Is it possible to programmatically force focus?

Thanks again!

Documentation improvement

You could add somewhere on README that if virtualenv is used, it must be created using --system-site-packages otherwise python doesn't have access to PyQt4 lib and error is shown.

virtualenv env --system-site-packages

Spent lot of time wondering why even after installing all the dependencies i got error when running webkit2png

>>> from PyQt4.QtCore import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyQt4.QtCore

Transparency

Currently, the output is rendered as it appears on screen. Would it be possible to somehow render a document with transparent background? I tried to mock about with the source my self, but I don't know Qt very well, so it's a bit overwhelming.

--wait doesn't always make it wait enough

Probably it works as intended but when you have plugins, like websites made entirely in flash, the webkit2png exits much sooner as it is needed for flash to load all the data and display the rendered content. So you end up with progress bars instead of oh-so-gorgeous website.

I've found that this works for me. In the waiting while:

while time.time() < waitToTime and QApplication.hasPendingEvents():
    QApplication.processEvents()

seems like plugins have no events to report so changing it to:

while time.time() < waitToTime:
    if QApplication.hasPendingEvents():
        QApplication.processEvents()

seems not to brake anything and to force the waiting the exact number of seconds as requested.

webkit2png-0.8.2.tar.gz has no library files inside

pip install -d /tmp/ webkit2png

Downloading/unpacking webkit2png
Downloading webkit2png-0.8.2.tar.gz
Saved /tmp/webkit2png-0.8.2.tar.gz
Running setup.py (path:/tmp/pip_build_root/webkit2png/setup.py) egg_info for package webkit2png

Successfully downloaded webkit2png
Cleaning up...

tar -tf /tmp/webkit2png-0.8.2.tar.gz

webkit2png-0.8.2/
webkit2png-0.8.2/PKG-INFO
webkit2png-0.8.2/setup.cfg
webkit2png-0.8.2/._setup.py
webkit2png-0.8.2/setup.py
webkit2png-0.8.2/webkit2png.egg-info/
webkit2png-0.8.2/webkit2png.egg-info/dependency_links.txt
webkit2png-0.8.2/webkit2png.egg-info/PKG-INFO
webkit2png-0.8.2/webkit2png.egg-info/SOURCES.txt
webkit2png-0.8.2/webkit2png.egg-info/top_level.txt

Image quality

How can I set the image quality?
I'm making browsershots with png extension, but the text quality on rendered html is low.

Font appearing as blocks

Hi I'm trying to screenshot a website in a different language the font appears as blocks instead of the actual characters is there a way to fix this? Here is an example url http://www.sun.mv/

wrong entry point in the setup.py

trying to install webkit2png using pip doesn't work at all in the setup.py there is a spurious reference to the github-cli:

 package_dir = {'webkit2png': 'webkit2png'},
 entry_points="""
 [console_scripts]
 ghi = github.issues:main

webkit2png hard to install

Using Python 2.6.5 on Ubuntu, the install instructions do not work - there is no such program as 'pip'.
Manually downloading webkit2png-0.8.2.tar.gz and running python setup.py install does not work - there is no such module as 'setuptools'.
I tried 'apt-get install python-pip' but it didn't help.
The tar file doesn't actually seem to contain any code anyway!

doesn't capture all images on sites that only load images on scroll down

webkit2png doesn't appear to capture images on sites that only load images when scrolled down.

A good example is: http://www.huffingtonpost.com/

Here is the (truncated) version that webkit2png captures:

www huffingtonpost com_webkit2png

And here is the (truncated) version that the Chrome extension Awesome Screenshot captures:

www huffingtonpost com_chrome_awesome_screenshot

I'm not sure if there is a workaround for this, or if this is by design (to not capture all images), but it would be nice if there was a command line option to do so.

Render to png , using Monospaced Font

Great tool! Just one thing.

I'm rendering my website to png file. In my website, I use Monospaced Font so that "-" and "A,C,G,T" have the same width. Yet when I render my website to png using webkit2png, it gives me quite ugly looking because of the Monospaced Font problem.

How to solve it?

Thanks.

_WebkitRendererHelper not being properly initialized

Weird problem, when _WebkitRendererHelper's init is called, I get "AttributeError: qWebSettings".

This seems to be because "self.dict.update(parent.dict)" is failing for some strange reason.

If I set "self._page.settings()" manually (by changing the code), I instead get "AttributeError: width".

The really strange part is if I add a line "print self.dict" in _WebkitRendererHelper it all looks correct, yet the object cannot find it's own attributes!

This is on Ubuntu Hardy running Python 2.5.2

about document

Is there a document or a demo?
I don't know how to use it.

Questions about usage

Hi,

I came across this package as I'm wanting to be able to take a screenshot of a website from a URL and then extract a color palette from that image. I'm using django on a site now that already extracts color palettes from images, I just need the functionality so that I can take screenshots when a user enters a URL. Would I be able to do that with this package?

can't open file 'scripts/webkit2png'

I used pip install webkit2png to install.
It looks like installed successful.
However, when I tried to run scripts/webkit2png -h I got this,

$ python: can't open file 'scripts/webkit2png': [Errno 2] No such file or directory

Some info you might wanna know,

  • OS: Mac OS X, 10.9.5
  • Python ,2.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.