From 35fbac92fc102c70ecf17727230334c2e8b77496 Mon Sep 17 00:00:00 2001 From: ZingBallyhoo Date: Tue, 21 Feb 2017 19:56:52 +0000 Subject: [PATCH] filechooser: Fix a crash when using a file as the path --- kivy/uix/filechooser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kivy/uix/filechooser.py b/kivy/uix/filechooser.py index 02991345d..af2c8f3a7 100644 --- a/kivy/uix/filechooser.py +++ b/kivy/uix/filechooser.py @@ -102,7 +102,7 @@ from kivy.properties import ( from os import listdir from os.path import ( basename, join, sep, normpath, expanduser, altsep, - splitdrive, realpath, getsize, isdir, abspath) + splitdrive, realpath, getsize, isdir, abspath, isfile, dirname) from fnmatch import fnmatch import collections @@ -838,6 +838,8 @@ class FileChooserController(RelativeLayout): def _add_files(self, path, parent=None): path = expanduser(path) + if isfile(path): + path = dirname(path) files = [] fappend = files.append