Skip to content

Commit 363b0d2

Browse files
committed
Fix compatibility with python2
1 parent 62d7e5e commit 363b0d2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tkfilebrowser/filebrowser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,9 @@ def __init__(self, parent, initialdir="", initialfile="", mode="openfile",
305305
# desktop
306306
try:
307307
desktop = check_output(['xdg-users-dir', 'DESKTOP']).decode().strip()
308-
except FileNotFoundError:
309-
# xdg-users-dir' not installed
308+
except Exception:
309+
# FileNotFoundError in python3 if xdg-users-dir is not installed,
310+
# but OSError in python2
310311
desktop = join(home, 'Desktop')
311312
if exists(desktop):
312313
self.left_tree.insert("", "end", iid=desktop, image=self.im_folder,

0 commit comments

Comments
 (0)