Use "with closing(tf)" since TarFile doesn't have .__exit__()
authorChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 21 Aug 2011 02:36:08 +0000 (21:36 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Sun, 21 Aug 2011 02:36:08 +0000 (21:36 -0500)
mediagoblin/gmg_commands/import_export.py

index 83d6431357c9f11ad22c3120927caa881ff2d02e..fd32136c74069aeac39997acf5d87da3fb71258a 100644 (file)
@@ -26,6 +26,7 @@ import subprocess
 import os.path
 import os
 import sys
+from contextlib import closing
 
 
 def import_export_parse_setup(subparser):
@@ -147,7 +148,7 @@ def _create_archive(args):
         args.tar_file,
         mode='w|gz')
 
-    with tf:
+    with closing(tf):
         tf.add(args.cache_path, 'mediagoblin-data/')
 
     print "\n== Archiving done ==\n"