Hello, I'm trying to read from a GFile, but can't figure out how to do it. I neither found an answer in the tutorial, nor in PyGObject's tests or examples.
Here is what I'm trying: $ echo "Test" > /tmp/tst $ python3 Python 3.2.1 (default, Jul 11 2011, 18:54:42) [GCC 4.6.1 20110627 (Red Hat 4.6.1-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from gi.repository import Gio >>> f = Gio.file_new_for_commandline_arg("/tmp/tst") >>> s = f.read(None) >>> a = bytearray(20) >>> s.read_all(a, 10, None) (True, 5) >>> a.decode("utf-8") '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' >>> a bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') Some tries along these lines also crashed the Python interpreter when trying to access the bytearray, but I can't reproduce it reliably. Thanks, Holger _______________________________________________ python-hackers-list mailing list python-hackers-list@gnome.org https://mail.gnome.org/mailman/listinfo/python-hackers-list