2 Apr 2010 10:34
Re: AttributeError: 'module' object has no attribute 'Builder'
Timo <timomlists <at> gmail.com>
2010-04-02 08:34:56 GMT
2010-04-02 08:34:56 GMT
On 01-04-10 20:18, Fernando Lopes Giovanini wrote:
> Hello to all.
>
> I'm new in python programming and I was trying to generate a executable
> file with py2exe from a simple program but I got this error:
>
> X:\Pareceres\dist\library.zip\gtk\_gtk.py:10: RuntimeWarning: tp_compare
> didn't return -1 or -2 for exception
> ImportError: could not import gio
> ImportError: could not import gio
>
Something similar happened to me when I updated my GTK+ and PyGTK
packages (2.18 and 2.16 resp.). I fixed it by adding gio to the Python
module includes (the same place where you add gobject, cairo, and
pangocairo).
Cheers,
Timo
> Traceback (most recent call last):
> File "pareceres.py", line 36, in<module>
> File "pareceres.py", line 16, in __init__
> AttributeError: 'module' object has no attribute 'Builder'
>
> As my programa is very simple, this is the source code:
>
> #!/usr/bin/python
> # -*- coding: latin-1 -*-
> import pygtk
> pygtk.require("2.0");
> import gtk
>
> class Parecer:
>
> def __init__(self):
> GLADE_FILE = 'viewConsulta.glade'
> # construindo nosso builder
> builder = gtk.Builder();
> # carregando o .glade no builder
> builder.add_from_file(GLADE_FILE);
> # conectando os sinais definidos durante a construção
> # da interface a métodos de mesmo nome no objeto atual
> builder.connect_signals(self);
>
> # carregando o widget criado no glade3 pelo nome
> self.main_window = builder.get_object("main_window");
>
> def sair(self, window):
> window.hide(); #minimisa a janela
> gtk.main_quit(); #finaliza o loop da gtk
>
> def show(self):
> self.main_window.show_all();
>
> app = Parecer();
>
> if __name__ == "__main__":
> app.show();
> gtk.main();
>
>
> Thanks to all.
> Fernando
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Py2exe-users mailing list
> Py2exe-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/py2exe-users
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
RSS Feed