Terry J. Reedy <[email protected]> added the comment:
Findfiles was more like os.walk than os.listdir. os.walk now uses os.scandir
instead of os.listdir. From 3.7.2 doc:
"By default, errors from the scandir() call are ignored. If optional argument
onerror is specified, it should be a function; it will be called with one
argument, an OSError instance. It can report the error to continue with the
walk, or raise the exception to abort the walk. Note that the filename is
available as the filename attribute of the exception object."
We should delete the try: except: and pass in a function to print the name and
error message. This could be done after getting a working patch.
Defaults are not needed as findfiles is called with 3 positional args. The
calling method should do the replacement of '' with os.curdir().
The patch must be incomplete as generators do not have a sort method. Replace
the first 3 lines of grep_it with
folder, filepat = os.path.split(path)
if not folder:
folder = os.curdir()
filelist = sorted(findfiles(folder, filepat, self.recvar.get())
and replace 'list' with 'filelist' in the following code.
Cheryl, grab the issue if you want to do this.
----------
nosy: +cheryl.sabella
stage: patch review -> needs patch
versions: +Python 3.7, Python 3.8 -Python 2.7, Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue23205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com