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 | 131 | else: |
| 132 | 132 | iglob = glob.iglob |
| 133 | 133 | for filespec in files: |
| 134 | + if not os.path.exists(filespec): | |
| 135 | + raise ValueError('given path {} does not exist!'.format(filespec)) | |
| 134 | 136 | for filename in iglob(filespec): |
| 135 | 137 | if zip_password is not None: |
| 136 | 138 | # Each file is expected to be a zip archive: | ... | ... |