[New-bugs-announce] [issue31959] Directory at `TemporaryDirectory().name` does not exist

Adam Dangoor report at bugs.python.org
Mon Nov 6 07:05:51 EST 2017


New submission from Adam Dangoor <adamdangoor at gmail.com>:

Sample code:

```
import os
from tempfile import TemporaryDirectory

name = TemporaryDirectory().name
print(os.path.exists(name))  # prints False

td = TemporaryDirectory()
name_2 = td.name
print(os.path.exists(name_2))  # prints True
```

Expected behavior: `True` is printed for both print statements.

I have run this example on:

* CPython 3.6.3
* CPython 3.5.3
* pypy 3.5.3

The unexpected behavior occurs on CPython 3.5.3 and CPython 3.6.X but not on pypy.

(bug found with Tim Weidner https://github.com/timaa2k).

----------
components: Library (Lib)
messages: 305637
nosy: Adam Dangoor
priority: normal
severity: normal
status: open
title: Directory at `TemporaryDirectory().name` does not exist
type: behavior
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31959>
_______________________________________


More information about the New-bugs-announce mailing list