[Tutor] Need help appending data to a logfile
Matt D
md123 at nycap.rr.com
Sat Jun 29 14:26:02 CEST 2013
>>
>
> Matt probably read somewhere about an interface like
>
> tempfile.TemporaryFile
>
> where the file has no explicit name, and will be deleted from disk, and
> the space reused as soon as it is closed.
>
> I don't believe he's using such an interface, however.
>
Yes that is what i was using.
with tempfile.NamedTemporaryFile('a+t',) as tf:
self.logfile = tf
or what i have now:
self.f = tempfile.NamedTemporaryFile()
'f' is the file the user opens but it has to be named up by the main
class constructor or the program gives this error:
ValueError: I/O operation on closed file
so i cant just pass the 'f' from the file dialog into the loop that
writes the data i need. at least i have been unable to find a way to do
this.
More information about the Tutor
mailing list