I am writing some unit tests for a piece of code that takes a path and attempts to load the file if it has a known extension, then does more careful checking.
In the
This doesn't work for you?
In [2]: tempfile.NamedTemporaryFile(suffix='.tif').name Out[2]: '/var/folders/gq/swc6jtld5853skyq_xc2lpc40000gn/T/tmplrtwvxg7.tif'
did you try?
fd, path =tempfile.mkstemp(suffix = '.tif') print(path)