[New-bugs-announce] [issue7325] tempfile.mkdtemp() does not return absolute pathname when dir is specified

Roy Smith report at bugs.python.org
Sat Nov 14 20:27:36 CET 2009


New submission from Roy Smith <roy at panix.com>:

The docs (http://www.python.org/doc/2.5.1/lib/module-tempfile.html) specify that 
mkdtemp(), "returns the absolute pathname of the new directory".  It does that in 
the default case, but if you specify a relative path for 'dir', you get back a 
relative path.


$ python
Python 2.5.1 (r251:54863, Oct 17 2008, 14:39:09) 
[GCC 3.4.6 20060404 (Red Hat 3.4.6-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tempfile
>>> tempfile.mkdtemp(dir='.')
'./tmpHk1pBD'

similar results were obtained on:

Python 2.5.1 (r251:54863, Feb  6 2009, 19:02:12) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin

Note that mkstemp() gets it right:

>>> tempfile.mkdtemp(dir='.')
'./tmpoPXdL7'
>>> tempfile.mkstemp(dir='.')
(3, '/Users/roy2/tmpwTGZ2y')
>>>

----------
components: Library (Lib)
messages: 95256
nosy: roysmith
severity: normal
status: open
title: tempfile.mkdtemp() does not return absolute pathname when dir is specified
type: behavior
versions: Python 2.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7325>
_______________________________________


More information about the New-bugs-announce mailing list