1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Fixed open tmp file in python3

This commit is contained in:
Max Shytikov
2014-04-22 21:32:34 +02:00
parent f0972628ef
commit 424c658da4

View 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: