os.tempnam() ignores dir

Steve Holden sholden at holdenweb.com
Mon Aug 12 15:45:56 EDT 2002


Don't know whether this was a bug. If so, it's certainly gone in 2.2.1 (see
Cygwin trace below).

Python 2.2.1 (#1, Jun 25 2002, 10:55:46)
[GCC 2.95.3-5 (cygwin special)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> print os.tempnam("/usr/bin", "rhub")
__main__:1: RuntimeWarning: tempnam is a potential security risk to your
program

/usr/bin/rhub610bfa94.0
>>>

The Activestate Windows 2.2 version I use appears to be rather lessw
cooperative, however:
>>> import os
>>> os.tempnam("C:\\Python22", "rhub")
__main__:1: RuntimeWarning: tempnam is a potential security risk to your
program

'C:\\DOCUME~1\\SHOLDEN\\LOCALS~1\\Temp\\rhub2'
>>>

Nothing obvious in the bug database. Maybe most people have moved on to
tmpfile, which the 2.2 documentation states is to be preferred?

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------


"Randall Hopper" <aa8vb at yahoo.com> wrote in message
news:mailman.1029176601.30107.python-list at python.org...
>     >>> print os.tempnam( '/home/rhh', 'prefix' )
>     /usr/tmp/prefiCAAa0MMvw
>
> Is this a bug?  I don't see any caveat in the docs about Python ignoring
> the dir argument.
>
> Thanks,
>
> Randall
>
> BTW: This is on Python 2.1
>






More information about the Python-list mailing list