]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fixed open tmp file in python3
authorMax Shytikov <mshytikov@gmail.com>
Tue, 22 Apr 2014 19:32:34 +0000 (21:32 +0200)
committerMax Shytikov <mshytikov@gmail.com>
Wed, 30 Apr 2014 00:36:26 +0000 (02:36 +0200)
vcr/migration.py

index d3e909a32058513734fd13f32f3d30a2a82865ca..da1f779bba8b4c5131e850045e0816a673f155d4 100644 (file)
@@ -65,7 +65,7 @@ def migrate_yml(in_fp, out_fp):
 def migrate(file_path, migration_fn):
     # because we assume that original files can be reverted
     # we will try to copy the content. (os.rename not needed)
-    with closing(tempfile.TemporaryFile()) as out_fp:
+    with closing(tempfile.TemporaryFile(mode='w+')) as out_fp:
         with open(file_path, 'r') as in_fp:
             migration_fn(in_fp, out_fp)
         with open(file_path, 'w') as in_fp: