Is it possible to get the path of a tempfile in Python 3

Use tempfile.NamedTemporaryFile to create a temporary file with a name, and then use the .name attribute of the object.

Note that there are platform-specific limitations on how this name can be used. The documentation says:

Whether the name can be used to open the file a second time, while the named temporary file is still open, varies across platforms (it can be so used on Unix; it cannot on Windows NT or later).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)