[pygtk] GFileInfo.get_modification_time() changed behaviour

Christian Mallwitz c.mallwitz at gmail.com
Mon Nov 19 01:17:47 WST 2012


Hi,

I've noticed some change behaviour around GFileInfo.get_modification_time()

Some system information:

$ uname -a
Linux si3655 3.2.0-33-generic-pae #52-Ubuntu SMP Thu Oct 18 16:39:21
UTC 2012 i686 i686 i386 GNU/Linux

$ lsb_release -c
Codename: precise

$ ls -l ~/foo
-rw-rw-r-- 1 christian christian 0 Nov 15 22:32 /home/christian/foo

$ python
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
>>> from gi.repository import GLib, Gio, Gtk
>>> print 'GTK+ version: %i.%i.%i' % (Gtk.get_major_version(), Gtk.get_minor_version(), Gtk.get_micro_version())
GTK+ version: 3.4.2

I have some older piece of code were this worked but now I get an error

>>> info = Gio.file_new_for_uri('file:///home/christian/foo').query_info('standard::*', Gio.FileQueryInfoFlags.NONE, None)
>>> tv = GLib.TimeVal()
>>> info.get_modification_time(tv)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
TypeError: get_modification_time() takes exactly 1 argument (2 given)

I have to explicitly request time::* attributes and
GFileInfo.get_modification_time() actually returns a value even though
my documentation is saying the GTimeVal value is "out
caller-allocates".

>>> info = Gio.file_new_for_uri('file:///home/christian/foo').query_info('standard::*,time::*', Gio.FileQueryInfoFlags.NONE, None)
>>> print info.get_modification_time().to_iso8601()
2012-11-15T22:32:37Z

I figured it out eventually but not because the documentation was of
any help. How/where would one learn about those things?

Thanks
Christian


More information about the pygtk mailing list