[PyQt] QWebKit issue with certain URLs

alan moore me at alandmoore.com
Wed Sep 24 04:56:24 BST 2008

I was trying to use QWebKit to create a basic browser to use with thin 
clients at our public library.  Everything was looking good, but I have 
found a URL on our server that simply will not load in a QWebview.  I 
have tried this using PyQT4.4 on Ubuntu Hardy Heron and on Windows XP, 
and get the same results.

The URL in question is: http://library.williamson-tn.org:90/kids

If you create a simple QWebview browser and try to load this URL, 
nothing happens.  And I mean nothing -- no exceptions raised, no errors, 
no 404.  Just acts like nothing happened.

I have tried converting this URL to a QUrl object both in one command 
and piecemeal, and in either case it shows as a valid URL.  But if I try 
to load it, or if I load a different page on the site and try to browse 
to that URL, nothing happens.

The page is simple HTML; needless to say it works fine in most other 
browsers (firefox, konqueror, opera, and IE have been tested with it), 
but QWebview chokes on it.  The only thing I can see is that it's on a 
non-standard port.  I did a test by running apache on my laptop on port 
90, and I found that it had some trouble browsing to subdirectories on 
nonstandard ports. Can anyone confirm this?  I've searched but found no 
one else mention this issue.

If anyone cares to try, here's a sample application:

#!/usr/bin/env python
from PyQT4.QtCore import *
from PyQT4.QtGui import *
from PyQT4.QtWebKit import *

app = QApplication([])
web = QWebView()
url = QUrl("http://library.williamson-tn.org")


Run this and click the "Kids online" link.  That tries to load the URL 
in question.

Can anyone confirm this for me, or am I just really unlucky?

More information about the PyQt mailing list