Apr-02-2023, 06:18 AM
(This post was last modified: Apr-02-2023, 06:18 AM by Gribouillis.)
(Apr-02-2023, 05:25 AM)tester_V Wrote: I'm clearly doing something wrongYour generator is generating a single item which is the whole list of subdirectories.
You could return the whole generator
def scan_dir(dir): return (str(x) for x in dir.iterdir() if x.is_dir())or
import os def scan_dir(dir): for name in next(os.walk(dir))[1]: yield os.path.join(dir, name)or
import os def scan_dir(dir): return (x.path for x in os.scandir(dir) if x.is_dir())I think the last one is better.