[issue46526] iglob exclude patterns

Henning Leth report at bugs.python.org
Tue Jan 25 17:41:06 EST 2022


New submission from Henning Leth <leth.henning at gmail.com>:

Got a project where I am looking for all files in a project dir, except the some files/dir/extentions that should be ignored.

Found a possible bug:
- the set has to be defined even though it was a set when defined
- f-string doesn´t work as I would expect

working code from my project:
ignore = {'*.tmp', 'test.txt', './tmp/*'}
for file in iglob('**/*[!f"{set(ignore)}"]', recursive=True):

code as i espected it would be writen:
... iglob(f'**/*[!{"ignore"}]', recursive=True)

----------
components: Library (Lib)
messages: 411682
nosy: leth.henning
priority: normal
severity: normal
status: open
title: iglob exclude patterns
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46526>
_______________________________________


More information about the Python-bugs-list mailing list