[pygtk] Can't subclass gio.File?

Jens Knutson jens.knutson at gmail.com
Wed Jun 23 11:38:33 WST 2010


Hi,

I am trying to subclass gio.File, but I'm having trouble... it seems
like Python (or gio) just won't let me. This snippet will explain it
fully:

import gio
class SubGio(gio.File):
    def __init__(self, path):
        super(gio.File, self).__init__(path)
    @property
    def name(self):
        return self.get_basename()

>>> sub = SubGio('foofile.txt')
>>> type(sub)
<class '__main__.__main__.GLocalFile'>
>>> sub.name
Traceback (most recent call last):
File "<input>", line 1, in <module>
AttributeError: '__main__.GLocalFile' object has no attribute 'name'


For reference, I'm using Python 2.6.4 and pygobject 2.21.1

Anyone know what's going on here??


Thanks!
Jens Knutson
-- 
"We act as though comfort and luxury were the chief requirements in
life, when all we need to make us really happy is something to be
enthusiastic about."
- Charles Kingsley
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20100622/c6d7a15e/attachment.htm 


More information about the pygtk mailing list