문제

My code:

import sys
import time
from PyQt4.QtGui import QApplication
from PyQt4.QtCore import QUrl
from PyQt4.QtWebKit import *



class Browser(QWebView):
  def __init__(self):
    QWebView.__init__(self)
    self.loadFinished.connect(self._result_available)

  def _result_available(self, ok):
    doc = self.page().mainFrame().documentElement()

    [...]



if __name__ == '__main__':
  app = QApplication(sys.argv)
  view = Browser()
  view.load(QUrl('http://www.example.net/'))
  app.exec_()

For some reason I get this error and I cannot figure it out why. I have updated to the latest qtwebkit version and still I get this. The QT manual said it was implemented in version 4.6 and I have qt version 4.6.2-26.el6_4.

I get the following error from the above code.

Traceback (most recent call last):
  File "web.py", line 15, in _result_available
    doc = self.page().mainFrame().documentElement()
AttributeError: 'QWebFrame' object has no attribute 'documentElement'

P.S. I also get this error since upgrading from qtwebkit version 2.0-3.el6 to 2.1.1-1.el6:

can't make "generic.orientation" because no QAccelerometer sensors exist
도움이 되었습니까?

해결책

I had a similar issue and unfortunately I have discovered that there is a bug in the Centos package as far as I can tell. I have run a comparison of the contents of all distributions for that version and they do not match. I will wait for an update of Centos that seems to be a bit behind other distributions.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top