Problem serialising TextBuffer

Posted by njallam on Ask Ubuntu See other posts from Ask Ubuntu or by njallam
Published on 2012-09-01T19:53:42Z Indexed on 2012/09/01 21:49 UTC
Read the original article Hit count: 189

The following is supposed to serialise a TextArea's content to a string. The first two line complete fine, however I have problems from then onwards.

page_content = subject_content.get_nth_page(pn)
page_name = subject_content.get_tab_label(page_content).get_text()
c_buffer = page_content.get_buffer()
c_format = c_buffer.register_serialize_tagset()
serial = c_buffer.serialize(c_format, c_buffer.get_start_iter(), c_buffer.get_end_iter())

The first error I get is:

Traceback (most recent call last):
  File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 251, in on_btn_save_clicked
    self.save()
  File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 160, in save
    c_format = c_buffer.register_serialize_tagset()
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
TypeError: register_serialize_tagset() takes exactly 2 arguments (1 given)

When inserting None as a parameter to c_format = c_buffer.register_serialize_tagset() I get the following as well:

Traceback (most recent call last):
  File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 251, in on_btn_save_clicked
    self.save()
  File "/home/nja/notetaker/notetaker/NotetakerWindow.py", line 161, in save
    serial = c_buffer.serialize(c_format, c_buffer.get_start_iter(), c_buffer.get_end_iter())
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
TypeError: serialize() takes exactly 5 arguments (4 given)

I have no idea of a workaround for that, however I shouldn't have to fill None in that other function in the first place.

What is happening here?

© Ask Ubuntu or respective owner

Related posts about application-development

Related posts about pygtk