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()
>             infile.close()
>             textbuffer.set_text(string)

Note that "if infile" does nothing: either the open succeeds and you get a  
file object which is *always* True, or the open fails and raises an  
exception and the code below never executes.

> As a test, I tried to write the buffer back to a file with this code
> but did not work,

"did not work" means...

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to