python and os.system() failure

Anthony enderkanchou at gmail.com
Wed May 18 00:23:28 EDT 2005


Michael Hoffman wrote:
>
> Why aren't you using NamedTemporaryFile instead? Using mkstemp adds a

> lot of complications that are usually unnecessary.

I believe I originally used mktemp(), but forgot how I learned that I
should use mkstemp() instead. I originally wrote the script over 1.5
years ago. =)
I may have been afraid of the "deleted when closed" at the time, but
now that really isn't an issue.

> > I will try to explicitly call a close() or whatever the syntax is
to
> > finalize the object to deletion by garbage collection.
>
> Files created with mkstemp are neither closed nor deleted when they
are
> finalized. I don't see how GC comes into it either.

Ah, that may explain it. Python.org did not say that mkstemp() is
outside of close or gc. I tried to both close and call gc at various
intervals, but, obviously, neither affected the running of the script.

Thanks alot, I think this will help. 

--
Anthony




More information about the Python-list mailing list