0

Just experimenting a bit with the Pyside WebView. I lack the understanding of what is going on in the background, and am finding it difficult to figure out why the images are not loading:

from PySide.QtCore import *
from PySide.QtGui import *
from PySide.QtWebKit import *
import sys

app = QApplication(sys.argv)
webView = QWebView()
webView.load(QUrl('https://www.google.si/search?q=cats&newwindow=1&source=lnms&tbm=isch&sa=X&ei=NlOgU4n6IpPX7AbR7IDICA&ved=0CAgQ_AUoAQ&biw=1097&bih=557'))
webView.show()
app.exec_()

I found this: How do I get PySide QWebView to display all images? However, it either went over my head, or is not related. More likely the first.

Thank you for your help!

Community
  • 1
  • 1
UrbKr
  • 621
  • 2
  • 11
  • 27
  • 1
    Works for me on Python 3.3 with PySide 1.2.1 on Windows 7. I see the page more or less exactly as in my browser. – NoDataDumpNoContribution Jun 18 '14 at 07:59
  • My setup is exactly the same, Windows 7 being 64bit. – UrbKr Jun 18 '14 at 16:20
  • For me too and I also use Python 3.3 64 bit and PySide from [here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyside). – NoDataDumpNoContribution Jun 18 '14 at 16:34
  • It's probably unlikely to matter, but are you using PySide 64bit or 32bit? Mine is 32bit. – UrbKr Jun 18 '14 at 16:43
  • What is your PySide version installed ? If you are using version older than 1.2.0, you need to run the pyside_postinstall script: python.exe Scripts\pyside_postinstall.py -install. But I recommend to install latest version, there is no need to run the scripts and you can install latest PySide via pip: pip install PySide – rlacko Jun 24 '14 at 07:02
  • My PySide is 1.2.1. I still tried both your suggestion, but the images are still not loading. – UrbKr Jun 24 '14 at 21:11
  • 1
    Please check if you don't have custom qt.conf in your path. The pyside is trying to load the qt.conf if it exists on path. qt.conf can be used to override the paths to qt plugins and if it contains invalid path then plugins are not found by qt runtime. – rlacko Jun 25 '14 at 07:17
  • 1
    To be more exact, the qt.conf is checked on executable path, here is the code from pyside, which is executed when pyside module is loading: exec_prefix = os.path.dirname(sys.executable). If qt.conf exists on exec_prefix path, then pyside is not trying to configure the qt runtime, instead, it leaves the qt runtime itself to bind the qt.conf at exec_prefix path. – rlacko Jun 25 '14 at 08:48
  • I searched in my Python directory and found one qt.conf in the PyQt4(which is not what I'm using) and one in the python root. Deleting the one in the root worked. Thank you very much sir! – UrbKr Jun 25 '14 at 10:52
  • Now, I can't give you the bounty since you solved the problem in the comments, so if you want you can post an answer, and I'll accept that one. – UrbKr Jun 25 '14 at 10:54

1 Answers1

1

Please check if you don't have custom qt.conf in your path. The pyside is trying to load the qt.conf if it exists on path. qt.conf can be used to override the paths to qt plugins and if it contains invalid path then plugins are not found by qt runtime.

To be more exact, the qt.conf is checked on executable path, here is the code from pyside, which is executed when pyside module is loading:

# Check if there is no default qt.conf in executable folder
exec_prefix = os.path.dirname(sys.executable)
qtconf_path = os.path.join(exec_prefix, 'qt.conf')
if os.path.exists(qtconf_path) and not force:
    return

If qt.conf exists on exec_prefix path, then pyside is not trying to configure the qt runtime, instead, it leaves the qt runtime itself to bind the qt.conf at exec_prefix path

rlacko
  • 571
  • 3
  • 11