Home Ask Login Register

Developers Planet

Your answer is one click away!

Qubix February 2016

Python - Using Qt5 to build a simple web browser

I was trying to build this example:


I'll just repost it here for completeness:

from PyQt5.QtCore import QUrl 
from PyQt5.QtWidgets import QApplication 
from PyQt5.QtWebKitWidgets import QWebView 
import sys

app = QApplication(sys.argv) 
view = QWebView() 

I also used the indications here to install pyqt5


and also installed Qt5. So I should have everything they say in the linuxvoice tutorial.

When I want to run this with python 2.7, it says:

 File "brows.py", line 9 SyntaxError: Non-ASCII character '\xe2' in file brows.py on line 9, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

and with Python3:

File "brows.py", line 9
SyntaxError: invalid character in identifier

Did anyone manage to make this work?


Nicholas Smith February 2016

You've got a stray byte somewhere in your code. It's popped up on StackOverflow previously and there's a good method for finding it: Python "SyntaxError: Non-ASCII character '\xe2' in file".

Post Status

Asked in February 2016
Viewed 3,357 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life