[New-bugs-announce] [issue24699] TemporaryDirectory is cleaned up twice

Ilya Kulakov report at bugs.python.org
Fri Jul 24 00:51:03 CEST 2015

New submission from Ilya Kulakov:

I'm seeing the issue using python 3.4.3 on Windows 8

In the __init__.py method of my package I define temporary directory at the module level like this:

_TempDir = tempfile.TemporaryDirectory(prefix='...'))
tempfile.tempdir = _TempDir.name

I expect it to be deleted on exit.

However, _sometimes_, I'm seeing the following exception on exit:

Traceback (most recent call last):
  File ":/weakref.pyo", line 582, in _exitfunc
  File ":/weakref.pyo", line 506, in __call__
  File ":/tempfile.pyo", line 674, in _cleanup
  File ":/shutil.pyo", line 478, in rmtree
  File ":/shutil.pyo", line 360, in _rmtree_unsafe
  File ":/shutil.pyo", line 358, in _rmtree_unsafe
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\

messages: 247233
nosy: Ilya.Kulakov
priority: normal
severity: normal
status: open
title: TemporaryDirectory is cleaned up twice
type: behavior
versions: Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list