assert Error in History class

5 views
Skip to first unread message

Han Liu

unread,
Oct 19, 2011, 8:42:47 AM10/19/11
to DreamPie
Hi,

I am trying to add a feature that commands in history can be save as
plain text. I felt it is handy for editing code later.

in order to do so I passed history to HistPersist.(maybe this is very
bad please tell me if it is ). And I tried to call
history.iter_get_command(it) to get commands. but I got a assert
Error. It seems the textview inside of HistPersist does not have text
which are tagged as command. I used code below:


def save_history_raw(textview, f,history):
"""
Save the history - the content of the textview - to a plain txt
file f.
"""
tv = textview
tb = tv.get_buffer()
style = tv.get_style()

it = tb.get_start_iter()

it_end = tb.get_end_iter()
#text = tb.get_text(it, it_end).decode('utf8')
# place Assert Error happend
texthistory = history.iter_get_command(it)
f.write(texthistory.encode('utf8'))

So did I call iter_get_command with wrong iterator? I am new to python
any suggestion will be welcome!

Regards,

Han Liu


Reply all
Reply to author
Forward
0 new messages