diff --git a/atomicwrites/__init__.py b/atomicwrites/__init__.py index 768e2ae..c2132d0 100644 --- a/atomicwrites/__init__.py +++ b/atomicwrites/__init__.py @@ -165,11 +165,13 @@ def _open(self, get_fileobject): except Exception: pass - def get_fileobject(self, dir=None, **kwargs): + def get_fileobject(self, suffix="", prefix=tempfile.template, dir=None, + **kwargs): '''Return the temporary file to use.''' if dir is None: dir = os.path.normpath(os.path.dirname(self._path)) - descriptor, name = tempfile.mkstemp(dir=dir) + descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, + dir=dir) # io.open() will take either the descriptor or the name, but we need # the name later for commit()/replace_atomic() and couldn't find a way # to get the filename from the descriptor.