Gabriel Farrell wrote:
> I have an issue with the tempfile module that I can't figure out.
>
> Snippet of relevant script looks like so:
>
> 1   bob = tempfile.NamedTemporaryFile()
> 2   bob.write('Hallo!')
> 3   bob.read()
> 4   sam = tempfile.NamedTemporaryFile()
> 5   bobHandle = file(bob.name)
> 6   bobHandle.read()
>
> As you can see, I'm creating two NamedTemporaryFiles and then reading
> from the first.  Line 3 doesn't really do anything, there's no output
> because we're reading at the end of the file, but as long as I leave
> it in, line 6 will output the expected 'Hallo!'.  If I remove it,
> there's no output from line 6.
>   
Try bob.flush() instead of bob.read(), my guess is the read() is forcing 
a flush().

Kent


_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to