Commit f75482f1fe29f059af37f39ecb831c605654b86d
1 parent
8b1381cd
Test whether files/paths exist before iterating in xglob (otherwise, no error is…
… thrown for invalid paths)
Showing
1 changed file
with
2 additions
and
0 deletions
oletools/thirdparty/xglob/xglob.py
| @@ -131,6 +131,8 @@ def iter_files(files, recursive=False, zip_password=None, zip_fname='*'): | @@ -131,6 +131,8 @@ def iter_files(files, recursive=False, zip_password=None, zip_fname='*'): | ||
| 131 | else: | 131 | else: |
| 132 | iglob = glob.iglob | 132 | iglob = glob.iglob |
| 133 | for filespec in files: | 133 | for filespec in files: |
| 134 | + if not os.path.exists(filespec): | ||
| 135 | + raise ValueError('given path {} does not exist!'.format(filespec)) | ||
| 134 | for filename in iglob(filespec): | 136 | for filename in iglob(filespec): |
| 135 | if zip_password is not None: | 137 | if zip_password is not None: |
| 136 | # Each file is expected to be a zip archive: | 138 | # Each file is expected to be a zip archive: |