]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Update filesystem.py
authorsmallcode <14190635@qq.com>
Tue, 22 Oct 2013 09:41:56 +0000 (17:41 +0800)
committersmallcode <14190635@qq.com>
Tue, 22 Oct 2013 09:41:56 +0000 (17:41 +0800)
fix WindowsError: [Error 32].
because must close the file before rename the file in window system.

vcr/persisters/filesystem.py

index ecbd9b77a372ac5eaddb81405ee19abe0192d666..6a1a275332b1b9a22782ebd90b84900c1da20288 100644 (file)
@@ -13,7 +13,7 @@ class FilesystemPersister(object):
         fd, name = tempfile.mkstemp(dir=dirname, prefix=filename)
         with os.fdopen(fd, 'w') as fout:
             fout.write(contents)
-            os.rename(name, path)
+        os.rename(name, path)
 
     @classmethod
     def write(cls, cassette_path, data):