From: Christian Herdtweck Date: Wed, 22 Jun 2016 16:16:35 +0000 (+0200) Subject: close fileobj only if it exists X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=1ce40e76ad9af7962783cf11e0622d94356cf078;p=python-delta-tar close fileobj only if it exists --- diff --git a/testing/__init__.py b/testing/__init__.py index c538fef..42ccef7 100644 --- a/testing/__init__.py +++ b/testing/__init__.py @@ -30,7 +30,8 @@ def closing_new_volume_handler(tarobj, base_name, volume_number): Handles the new volumes ''' volume_path = "%s.%d" % (base_name, volume_number) - tarobj.fileobj.close() + if tarobj.fileobj: + tarobj.fileobj.close() tarobj.open_volume(volume_path) class BaseTest(unittest.TestCase):