diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 4176dcfa9708..ead199e2095a 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -2027,7 +2027,7 @@ def dump_model(self, fout, fmap='', with_stats=False, dump_format="text"): """ if isinstance(fout, (STRING_TYPES, os.PathLike)): fout = os.fspath(os.path.expanduser(fout)) - fout = open(fout, 'w') + fout = open(fout, 'w') # pylint: disable=consider-using-with need_close = True else: need_close = False