[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2019-05-23 Thread Cheryl Sabella
Change by Cheryl Sabella : -- nosy: +pitrou type: behavior -> enhancement versions: +Python 3.8 -Python 3.4, Python 3.5, Python 3.6, Python 3.7 ___ Python tracker ___ _

[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala
Prudvi RajKumar Maddala added the comment: Made changes, pathlib.Path('.').iterdir() now throws a FileNotFoundError if the path is not valid. -- nosy: +prudvinit ___ Python tracker _

[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Paul Pinterits
Paul Pinterits added the comment: As an afterthought, I'd like to suggest an alternative solution: If changing the `iterdir` behavior is not possible or not desirable for some reason, please add a `Path.listdir` method that returns a list instead of an iterator. Lazy file system operations c

[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala
Change by Prudvi RajKumar Maddala : -- pull_requests: +8470 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Prudvi RajKumar Maddala
Change by Prudvi RajKumar Maddala : -- keywords: +patch pull_requests: +8467 stage: -> patch review ___ Python tracker ___ ___ Pyth

[issue34541] pathlib.Path.iterdir doesn't throw an exception until you start iterating

2018-08-29 Thread Paul Pinterits
New submission from Paul Pinterits : The fact that `Path.iterdir()` only throws exceptions once you start iterating over it makes it very difficult to write correct code. Let's look at an example: We'll iterate over all children of a directory and print their file size. If we try to do it li