plyer icon indicating copy to clipboard operation
plyer copied to clipboard

Fixing DOCUMENTS key and raised exception

Open Nibodhika opened this issue 5 years ago • 2 comments

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

Nibodhika avatar Feb 19 '20 00:02 Nibodhika

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

Nibodhika avatar Feb 19 '20 00:02 Nibodhika

Since no one is replying with any counter-argument, I went ahead and fixed it in case this is merged.

Nibodhika avatar Mar 01 '20 22:03 Nibodhika