From: Christopher Allan Webber Date: Sun, 21 Aug 2011 02:36:08 +0000 (-0500) Subject: Use "with closing(tf)" since TarFile doesn't have .__exit__() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c02bea6fb9a87e4cbcb8d77912a92b2226b4eceb;p=mediagoblin.git Use "with closing(tf)" since TarFile doesn't have .__exit__() --- diff --git a/mediagoblin/gmg_commands/import_export.py b/mediagoblin/gmg_commands/import_export.py index 83d64313..fd32136c 100644 --- a/mediagoblin/gmg_commands/import_export.py +++ b/mediagoblin/gmg_commands/import_export.py @@ -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"