开发者

how can I catch the error of "no existing page" in python

开发者 https://www.devze.com 2022-12-14 12:46 出处:网络
I developpe a browser with python and pyqt4 but I don\'t know what I put in loaderror try: self.webView.load(QtCore.QUrl(self.lineEdit.text()))

I developpe a browser with python and pyqt4 but I don't know what I put in loaderror

try: 
    self.webView.load(QtCore.QUrl(self.lineEdit.text()))
except loade开发者_开发百科rreur:
    self.webView.load(QtCore.QUrl('erreur.html'))

when the page doesn't exist thx


Try loading up your browser of choice, and see what they do when given a page that doesn't exist.

You likely want to mimic that behaviour (Generic 404 page).

0

精彩评论

暂无评论...
验证码 换一张
取 消