From 643289e013a8cc960defaf3f43731e834f6f627a Mon Sep 17 00:00:00 2001 From: ac Date: Tue, 21 Aug 2007 20:39:21 +0200 Subject: [PATCH] [svn r45901] Do not use os.tmpfile() as it will fail on Windows unless You are Administrator. --HG-- branch : trunk --- py/io/fdcapture.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/py/io/fdcapture.py b/py/io/fdcapture.py index 83c1aede3..59c56266f 100644 --- a/py/io/fdcapture.py +++ b/py/io/fdcapture.py @@ -2,6 +2,7 @@ import os import sys import py +import tempfile class FDCapture: """ Capture IO to/from a given os-level filedescriptor. """ @@ -41,7 +42,7 @@ class FDCapture: def maketmpfile(self): """ create a temporary file """ - f = os.tmpfile() + f = tempfile.TemporaryFile() newf = py.io.dupfile(f) f.close() return newf @@ -49,7 +50,7 @@ class FDCapture: def writeorg(self, str): """ write a string to the original file descriptor """ - tempfp = os.tmpfile() + tempfp = tempfile.TemporaryFile() try: os.dup2(self._savefd, tempfp.fileno()) tempfp.write(str)