[pygtk] Unable to run your tutorial examples

John Finlay finlay at moeraki.com
Wed Dec 17 05:23:45 WST 2008


A.K.Karthikeyan wrote:
> Hello PyGTK people,
>
> I have tried to run *pygtkconsole.py* 
> <http://www.pygtk.org/pygtk2tutorial/examples/pygtkconsole.py> and 
> *gpython.py* <http://www.pygtk.org/pygtk2tutorial/examples/gpython.py> 
> found in http://www.pygtk.org/pygtk2tutorial/ch-Introduction.html on my 
> Ubuntu 8.04, but I got the following error message
>
> <http://www.pygtk.org/pygtk2tutorial/examples/gpython.py>
> Traceback (most recent call last):
>   File "pygtkconsole.py", line 14, in <module>
>     import gtk
>   File "/media/sda7/python/py/gtk.py", line 2
> SyntaxError: Non-ASCII character '\xe2' in file 
> /media/sda7/python/py/gtk.py on line 2, but no encoding declared; see 
> http://www.python.org/peps/pep-0263.html for details
>
> and
>
> Traceback (most recent call last):
>   File "gpython.py", line 16, in <module>
>     import gtk, gobject
>   File "/media/sda7/python/py/gtk.py", line 2
> SyntaxError: Non-ASCII character '\xe2' in file 
> /media/sda7/python/py/gtk.py on line 2, but no encoding declared; see 
> http://www.python.org/peps/pep-0263.html for details
>
> I am clueless what to even after visiting 
> http://www.python.org/peps/pep-0263.html as there are no non-ASCII 
> characters in program. Can any one help me?
>   
The problem is the file "/media/sda7/python/py/gtk.py" that interferes 
with the importing of the gtk module. If possible you should rename this 
file or make sure it isn't in the import path of python.

John


More information about the pygtk mailing list