Skip to content

NamedTemporaryFile / mkstemp appear to allow Path for dir= parameter though undocumented #2749

@asottile

Description

@asottile
>>> from pathlib import Path
>>> d = Path('/tmp/wat')
>>> d.mkdir(exist_ok=True, parents=True)
>>> import tempfile
>>> with tempfile.NamedTemporaryFile(dir=d) as f:
...     print(f.name)
... 
/tmp/wat/tmp68qwo9yy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions