I am struggling with a problem, that is really driving me nuts. I installed Pygtk-all-in-one Bundle version 2.24.2 for Python 2.7 [1] and Python 2.7.5 [2].
Now I want to use gtk.builder to load my glade file.
My python file looks like:
#!/usr/bin/python
#-*- coding: utf-8 -*-
import sys
import gtk
import gtk.glade
class QueryRelevanceEvaluationApp:
def __init__(self):
builder = gtk.Builder()
builder.add_from_file("C:\blubb.glade")
builder.connect_signals(self)
app = QueryRelevanceEvaluationApp()
gtk.main()
My glade file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy project-wide -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</interface>
If I run the application, I get the following error:
Process started >>>
Traceback (most recent call last):
File "C:\Users\Bernhard\Documents\test\base2.py", line 16, in <module>
app = QueryRelevanceEvaluationApp()
File "C:\Users\Bernhard\Documents\test\base2.py", line 13, in __init__
builder.add_from_file("C:\blubb.glade")
glib.GError: Datei ┬╗Clubb.glade┬½ konnte nicht ge├Âffnet werden: Invalid argument
However, If I rename "blubb.glade" to "hallo-welt2.ui" everyhing works fine. I am relatively new to Python, so I don't really know, what's causing the problem. At first, I thought, that something with my Pygtk installation was wrong, but than I discovered the strange behaviour, that everything works fine, after renaming the file. So I am thinking, that maybe something else (charset?) is causing the problem. I am working on a Windows 7 64 bit machine (my system language is german).
It would be really nice, If someone could give me a hint on how I can solve this problem.
Thanks in advance!
Greetings from Austria
[1] http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.2.win32-py2.7.msi
\b
is a backspace character, AFAIR; you should escape the backslash:
>>> print "C:\blubb.glade"
Clubb.glade
>>> print "C:\\blubb.glade"
C:\blubb.glade