diff --git a/src/DIRAC/Core/Utilities/File.py b/src/DIRAC/Core/Utilities/File.py index 79ecbdeb240..9548faea8a6 100755 --- a/src/DIRAC/Core/Utilities/File.py +++ b/src/DIRAC/Core/Utilities/File.py @@ -273,7 +273,7 @@ def secureOpenForWrite(filename=None, *, text=True): ) else: fd, filename = tempfile.mkstemp(text=text) - with open(fd, "w" if text else "wb", encoding="ascii") as fd: + with open(fd, "w" if text else "wb", encoding="ascii" if text else None) as fd: yield fd, filename