Subversion Repositories freemyipod

Rev

Rev 860 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 860 Rev 861
Line 146... Line 146...
146
 
146
 
147
def fileoperation(infilepath, outfilepath, function):
147
def fileoperation(infilepath, outfilepath, function):
148
    with open(infilepath, "rb") as infile:
148
    with open(infilepath, "rb") as infile:
149
        infiledata = infile.read()
149
        infiledata = infile.read()
150
    
150
    
151
    try:
-
 
152
        outfiledata = function(infiledata)
151
    outfiledata = function(infiledata)
153
    except:
-
 
154
        os.remove(outfilepath)
-
 
155
        raise
-
 
156
    
152
    
157
    with open(outfilepath, "wb") as outfile:
153
    with open(outfilepath, "wb") as outfile:
158
        outfile.write(outfiledata)
154
        outfile.write(outfiledata)
159
 
155
 
160
def s5l8701cryptdfufile(infile, outfile):
156
def s5l8701cryptdfufile(infile, outfile):