Use "with closing(tf)" since TarFile doesn't have .__exit__()
This commit is contained in:
parent
cd8c65133e
commit
c02bea6fb9
@ -26,6 +26,7 @@ import subprocess
|
|||||||
import os.path
|
import os.path
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
|
|
||||||
def import_export_parse_setup(subparser):
|
def import_export_parse_setup(subparser):
|
||||||
@ -147,7 +148,7 @@ def _create_archive(args):
|
|||||||
args.tar_file,
|
args.tar_file,
|
||||||
mode='w|gz')
|
mode='w|gz')
|
||||||
|
|
||||||
with tf:
|
with closing(tf):
|
||||||
tf.add(args.cache_path, 'mediagoblin-data/')
|
tf.add(args.cache_path, 'mediagoblin-data/')
|
||||||
|
|
||||||
print "\n== Archiving done ==\n"
|
print "\n== Archiving done ==\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user