qt - Python - Using Qt5 to build a simple web browser -


i trying build example:

https://www.linuxvoice.com/build-a-web-browser-with-20-lines-of-python/

i'll repost here completeness:

from pyqt5.qtcore import qurl  pyqt5.qtwidgets import qapplication  pyqt5.qtwebkitwidgets import qwebview  import sys  app = qapplication(sys.argv)  view = qwebview()  view.show()  view.seturl(qurl(“http://linuxvoice.com”))  app.exec() 

i used indications here install pyqt5

https://askubuntu.com/questions/612314/how-to-install-pyqt-for-python3-in-ubunt-14-10

and installed qt5. should have in linuxvoice tutorial.

when want run python 2.7, says:

 file "brows.py", line 9 syntaxerror: non-ascii character '\xe2' in file brows.py on line 9, no encoding declared; see http://www.python.org/peps/pep-0263.html details 

and python3:

file "brows.py", line 9 view.seturl(qurl(“http://linuxvoice.com”))  syntaxerror: invalid character in identifier 

did manage make work?

so here's actual answer. had same issue , discovered fast. view.seturl(qurl(“http://linuxvoice.com”)) notice code uses quotes, @ how quotes compared normal quotes.

normal: ""

theirs: “”

basically, they're using weird ascii quotes python can't handle. sneaky way prevent copy-pasters. either way code doesn't work anymore because in recent version of pyqt5, qtwebkitwidgets removed.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -