Package Ganga :: Package Utility :: Module tempfile_compatibility
[hide private]
[frames] | no frames]

Source Code for Module Ganga.Utility.tempfile_compatibility

 1   
 2  # tempfile - python2.3 compatibility module  
 3   
 4  # provides simple implementation for mkdtemp 
 5   
 6  import tempfile 
 7  from tempfile import * 
 8   
 9  if not hasattr(tempfile,'mkdtemp'): 
10 - def mkdtemp(suffix='',prefix='',dir=''):
11 if prefix or dir: 12 import Ganga.Utility.logging 13 logger = Ganga.Utility.logging.getLogger() 14 logger.warning('tempfile.mkdtemp(): prefix and dir arguments ignored in Python 2.3 compatibility mode') 15 16 tempdir = mktemp(suffix) 17 try: 18 import os 19 os.mkdir(tempdir) 20 # probably we should chmod to 700 21 except IOError,x: 22 raise 23 return tempdir
24