On Aug 2, 7:43 pm, William Stein <
wst...@gmail.com> wrote:
> If the data is ephemeral, you could use the tempfile module.
Thanks! excellent suggestion. For future reference:
If you do:
import tempfile
F=tempfile.NamedTemporaryFile()
then you have a usable (existing) filename F.name
Beware that once the reference to F gets lost, the file gets deleted.
Pass "delete=false" to NamedTemporaryFile to avoid that (but then you
need to clean up yourself). An even dirtier version is
filename=tempfile.NamedTemporaryFile().name
which does give you a filename that is all likelyhood is usable and
probably nonexistent, but leaves you with a nasty racing condition
(see tempfile docs).