1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 17:15:35 +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): def migrate(file_path, migration_fn):
# because we assume that original files can be reverted # because we assume that original files can be reverted
# we will try to copy the content. (os.rename not needed) # 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: with open(file_path, 'r') as in_fp:
migration_fn(in_fp, out_fp) migration_fn(in_fp, out_fp)
with open(file_path, 'w') as in_fp: with open(file_path, 'w') as in_fp: