Execution of Python script is not releasing a file, so no furhter operations can be completed against it.
Unfortunately I’m not sure there is much we can do about this. The script engine is Iron Python… which is written by microsoft. If you provide us with a sample that demonstrates the problem we can take a look and perhaps log it with them.
Here is a sample which is having similar issues. I wouldl ike to be able to delte file1 and file2 in later steps, after I have used them as part of a cleanup before the project closes. At this point the files cannot be deleted until after the FB project is closed. I used unlocker to determine what is locking the file and it does not clear until I close FB.
this is using the Run Script action, OnExecute (script language=Python)
import sys, re
regex=re.compile(r'(^[\w]+\.[\w\W]+$)')
file1 = open(FBVariables["tempFile"],"r")
file2 = open(FBVariables["revisionList"], "w")
unique_lines = list(set(file1.read().splitlines()))
unique = set(file1.read().split("\n"))
#print unique_lines
#print "\nsorted lines:\n"
unique_lines.sort()
for item in unique_lines:
a=item.split("/")
#print "last item is %s" % (a[-1])
fname=regex.match(a[-1])
if fname is not None:
#print "match on item %s" % (item)
file2.write("".join(item + "\n"))
#else:
#print "NOT including item: %s" % (item)
file1.close()
file2.close()
Hi Lee,
Wrapping the code between opening the file and closing it within a Try...Finally block should fix the problem you're having, for example:
Regards,
Paul.