diff --git a/xcp/cpiofile.py b/xcp/cpiofile.py index bb681dfc..d7ddd7b4 100755 --- a/xcp/cpiofile.py +++ b/xcp/cpiofile.py @@ -278,10 +278,6 @@ def __init__(self, name, mode, comptype, fileobj, bufsize): self._init_write_gz() if comptype == "bz2": - try: - import bz2 - except ImportError: - raise CompressionError("bz2 module is not available") if mode == "r": self.dbuf = b"" self.cmp = bz2.BZ2Decompressor() @@ -561,7 +557,6 @@ def __init__(self, fileobj, mode): self.init() def init(self): - import bz2 self.pos = 0 if self.mode == "r": self.cmpobj = bz2.BZ2Decompressor() @@ -1106,11 +1101,6 @@ def bz2open(cls, name, mode="r", fileobj=None, compresslevel=9): if len(mode) > 1 or mode not in "rw": raise ValueError("mode must be 'r' or 'w'.") - try: - import bz2 - except ImportError: - raise CompressionError("bz2 module is not available") - if fileobj is not None: fileobj = _BZ2Proxy(fileobj, mode) else: