Solved! # Output file outfile = open("newbannedsitelist", "w") outfile.write(textbuffer.get_text(textbuffer.get_start_iter(), textbuffer.get_end_iter(), include_hidden_chars=True)) outfile.close()
I'm new to Python and GTK and may not be asking the right type of questions initially. I programmed with C many many years ago and my programming instincts are very rusty so still feeling my way again with this stuff. Apologies for the sarcastic reply earlier but i felt your initial reply to be sarcastic. I also did research this problem but seemed to be getting nowhere - thats why I asked for the groups help. Anyway, thanks to all that replied via emailed and in this group. On Feb 18, 7:34 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 17 Feb 2007 17:10:50 -0800, google wrote: > > I just included file opening code just to show how i read the file > > into the text buffer - I have no issues with this as such. Problem is > > only with the writing of the text buffer back to a file. When I try to > > write the buffer to a file it gave the following, > > > <gtk.TextBuffer object (GtkTextBuffer) at 0xb7cff284> > > Traceback (most recent call last): > > File "./configbox.py", line 78, in ? > > TextViewExample() > > File "./configbox.py", line 53, in __init__ > > outfile.write(textbuffer.get_text(0,1000, > > include_hidden_chars=True)) > > TypeError: start should be a GtkTextIter > > Ah, well there's your problem. start should be a GtkTextIter, just like > the exception says. > > Question for you: in the line of code in the traceback, which function > takes an argument called "start"? > > > How can I use outfile.write() to wite the contents of the text buffer > > correctly? > > Your problem isn't with outfile.write(). > > -- > Steven. -- http://mail.python.org/mailman/listinfo/python-list