[py-svn] r45901 - py/trunk/py/io

ac at codespeak.net ac at codespeak.net
Tue Aug 21 20:39:22 CEST 2007


Author: ac
Date: Tue Aug 21 20:39:21 2007
New Revision: 45901

Modified:
   py/trunk/py/io/fdcapture.py
Log:
Do not use os.tmpfile() as it will fail on Windows unless You are Administrator.

Modified: py/trunk/py/io/fdcapture.py
==============================================================================
--- py/trunk/py/io/fdcapture.py	(original)
+++ py/trunk/py/io/fdcapture.py	Tue Aug 21 20:39:21 2007
@@ -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 @@
     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 @@
     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)


More information about the py-svn mailing list