summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2017-06-27 21:07:19 +1000
committerDylan Araps <dylan.araps@gmail.com>2017-06-27 21:07:19 +1000
commitb5c27de8b55483e0157ec899dd4f39fba9f1fe74 (patch)
tree4396215508a4cc4524abc7da1bbf1854ba22654d
parentbb81f1a43d4bc88d2bf1935a54c148302dd96d14 (diff)
image: Use os.scandir to find images.
-rwxr-xr-xpywal/gen_colors.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pywal/gen_colors.py b/pywal/gen_colors.py
index 773c1a8..f626125 100755
--- a/pywal/gen_colors.py
+++ b/pywal/gen_colors.py
@@ -22,8 +22,8 @@ def random_img(img_dir):
# Add all images to a list excluding the current wallpaper.
file_types = (".png", ".jpg", ".jpeg", ".jpe", ".gif")
- images = [img for img in os.listdir(img_dir)
- if img.endswith(file_types) and img != current_wall]
+ images = [img for img in os.scandir(img_dir)
+ if img.name.endswith(file_types) and img.name != current_wall]
return pathlib.Path(img_dir / random.choice(images))