diff --git a/virttest/cartesian_config.py b/virttest/cartesian_config.py index 39fcb279a3..ca8589c05d 100755 --- a/virttest/cartesian_config.py +++ b/virttest/cartesian_config.py @@ -441,7 +441,8 @@ def __init__(self, filename): :parse filename: The name of the input file. """ - StrReader.__init__(self, open(filename).read()) + with open(filename) as f: + StrReader.__init__(self, f.read()) self.filename = filename