os independent temp dir?
Mike C. Fletcher
mcfletch at home.com
Wed May 9 14:56:13 EDT 2001
How about:
>>> import os
>>> def getTemp():
... for possible in ('temp','tmp','tmpdir'):
... if os.environ.has_key( possible):
... return os.environ[ possible ]
...
>>> getTemp()
'c:\\temp'
>>>
No idea if the Mac even has environmental variables, so no help there...
It's a hack, but oh well :) .
Mike
-----Original Message-----
From: ransen_spam_me_not at nemo.it [mailto:ransen_spam_me_not at nemo.it]
Sent: May 9, 2001 12:22
To: python-list at python.org
Subject: Re: os independent temp dir?
On Tue, 08 May 2001 11:33:47 -0700, "Julio F. Schwarzbeck"
<jflores at codeit.com> wrote:
>import tempfile
>tmpDir = tempfile.tempdir
>
>If TMPDIR os environment var is not set, None is return, works in Linux &
>Win afaik.
I had already tried that, and on my Windows machine
returns None. I was hoping for something like
C:\Windows\Temp , which does exist on my machine.
I will need it for the Mac too... :(
--
Owen F. Ransen
http://www.ransen.com/
Home of Gliftic & Repligator Image Generators
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list