Re: How do I save the contents of a text buffer

2007-02-18 Thread google
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 program

Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
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 ga

Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 17:19:06 -0800, google wrote: >> Did you get an exception? Maybe something about not being able to open >> the file for reading? Or perhaps disk full? > > File read ok for input, its the file write thats the problem Well, duh. I know that -- that's what your first email said.

Re: How do I save the contents of a text buffer

2007-02-17 Thread google
On Feb 18, 1:14 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 17 Feb 2007 15:47:20 -0800, google wrote: > > As a test, I tried to write the buffer back to a file with this code > > but did not work, > > Oooh, guessing games! I love guessing games! Good > Let me see... did it reboot you

Re: How do I save the contents of a text buffer

2007-02-17 Thread google
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, Traceback (most recent call last): Fi

Re: How do I save the contents of a text buffer

2007-02-17 Thread Gabriel Genellina
En Sat, 17 Feb 2007 20:47:20 -0300, <[EMAIL PROTECTED]> escribió: > I'm using Python with pygtk and have this problem - I have read the > contents of a file into the text buffer with this code, > > infile = open("mytextfile", "r") > if infile: > string = infile.read() >

Re: How do I save the contents of a text buffer

2007-02-17 Thread Steven D'Aprano
On Sat, 17 Feb 2007 15:47:20 -0800, google wrote: > As a test, I tried to write the buffer back to a file with this code > but did not work, Oooh, guessing games! I love guessing games! Let me see... did it reboot your PC? Did Python crash? Did you get an exception? Maybe something about not b

How do I save the contents of a text buffer

2007-02-17 Thread google
Hi, I'm using Python with pygtk and have this problem - I have read the contents of a file into the text buffer with this code, infile = open("mytextfile", "r") if infile: string = infile.read() infile.close() textbuffer.set_text(string) As a t