diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-09-15 10:42:16 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-09-15 12:30:09 +0200 |
commit | c4d9e922eefd08382e7a4f9fb1926f82a3f8fc4d (patch) | |
tree | 5dce62df2fc15f2858626ef0d0076281ff918678 /solenv | |
parent | cf0c04d5fc85acbe6cbeb090de6a739a0d5a8d30 (diff) |
Don't use argparse to open control_file
Use idiomatic 'with' instead
This avoids the warnings:
Exception ignored in: <_io.FileIO name='C:/lo/src/core/postprocess/packimages/image-sort.lst' mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.TextIOWrapper name='C:/lo/src/core/postprocess/packimages/image-sort.lst' mode='r' encoding='cp1251'>
Change-Id: I1cf8248cdab8dd9fd585545c64de2aebcbfe5365
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102647
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/image-sort.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/solenv/bin/image-sort.py b/solenv/bin/image-sort.py index d45037e25c7f..75b5da6ce0e7 100644 --- a/solenv/bin/image-sort.py +++ b/solenv/bin/image-sort.py @@ -120,7 +120,7 @@ def chew_controlfile(ifile): parser = argparse.ArgumentParser() # where the control file lives -parser.add_argument('control_file', metavar='image-sort.lst', type=open, +parser.add_argument('control_file', metavar='image-sort.lst', help='the sort control file') # where the uiconfigs live parser.add_argument('base_path', metavar='directory', @@ -138,7 +138,8 @@ else: args.output = sys.stdout close_output = False -chew_controlfile(args.control_file) +with open(args.control_file) as cf: + chew_controlfile(cf) for icon in global_list: if not icon.startswith('sc_'): |