plyer
plyer copied to clipboard
Fixing DOCUMENTS key and raised exception
Hello, I was trying to use plyer and I found that I couldn't access document folder on my Linux, this was because of two reasons:
with open(self._get_home_dir() + USER_DIRS, "r") as f:
raises a FileNotFoundError
if ~/.config/user-dirs.dirs
doesn't exist (but the current code is only handling the case of KeyError
, which happens if the key does not exist in user-dirs).
Also line 47 was sending DOCUMENT
which worked for the user-dirs.dirs
because it started with the same characters, but failed when trying to access PATHS
because the key is DOCUMENTS
Also, I didn't wanted to change that because it might be a reason, but shouldn't the line 33 be:
return self._get_home_dir() + PATHS[name]
Otherwise if the first check fails the function returns /Documents
instead of ~/Documents
Since no one is replying with any counter-argument, I went ahead and fixed it in case this is merged.