diff --git a/versionstamping/versionstamper.py b/versionstamping/versionstamper.py index 48d9f45..f42e54d 100644 --- a/versionstamping/versionstamper.py +++ b/versionstamping/versionstamper.py @@ -27,11 +27,13 @@ def main(argv): return 1 with open(filetoconvert, 'x') as f: - with open(filecopy) as c: + with open(filecopy,'r') as c: print("Detected %s instances of %s pre-conversion"%(c.read().count(pattern),pattern)) converted = c.read().replace(pattern, substitute) print("Confirmed %s instances of %s post-conversion"%(converted.count(substitute),substitute)) f.write(converted) + c.close() + f.close() return 0