Changeset 501 for trunk


Ignore:
Timestamp:
Aug 7, 2006, 9:26:29 AM (18 years ago)
Author:
nkissebe
Message:

the result of NamedTemporaryFile?() can not be opened by another process under Windows. Use mkstemp() instead. Temporary file has to be manually deleted however.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/apps/rerun

    r299 r501  
    7979
    8080    # prepare text variables
    81     myTmpFile = tempfile.NamedTemporaryFile()
    82     outCmd = '<command>echo =RAPPTURE-RUN=>%s</command>' % myTmpFile.name
    83 
     81    myTmpFilefd, myTmpFileName = tempfile.mkstemp()
     82    myTmpFile = os.fdopen(myTmpFilefd,'w+b')
     83    outCmd = '<command>echo =RAPPTURE-RUN=>' + myTmpFileName.encode('string_escape') + '</command>'
    8484    # do the file <command> switheroo!
    8585    xmlfile = open(runFile, "rb").read()
     
    8989
    9090    # run driver on the temporary run file
    91     print "myTmpFile.name = %s" % (myTmpFile.name)
    92     systemCmd = '%s -tool %s' % (driverPath, myTmpFile.name)
     91    print "myTmpFileName = %s" % (myTmpFileName)
     92    systemCmd = '%s -tool %s' % (driverPath, myTmpFileName)
    9393    os.system(systemCmd)
    9494
     
    9696
    9797    # clean up our tmp file
    98     # the tempfile module deletes the file automatically when closed
     98    # tempfile module does not auto delete files created by mkstemp on close
    9999    myTmpFile.close()
     100    os.remove(myTmpFileName)
    100101
    101102    # exit gracefully
Note: See TracChangeset for help on using the changeset viewer.