Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PermissionError in populate_tree #208

Closed
csatt opened this issue Apr 14, 2023 · 0 comments
Closed

PermissionError in populate_tree #208

csatt opened this issue Apr 14, 2023 · 0 comments
Assignees
Labels

Comments

@csatt
Copy link
Owner

csatt commented Apr 14, 2023

Hit this just trying to recreate a screenshot for the User Guide update:

Unexpected error: <class 'PermissionError'>
Traceback (most recent call last):
File "/Users/csatt/.pyenv/versions/3.11.2/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tkinter/init.py", line 1948, in call
return self.func(*args)
^^^^^^^^^^^^^^^^
File "/Users/csatt/GitHub/IV_Swinger/python3/./IV_Swinger2_gui.py", line 3330, in change_folder
self.populate_tree()
File "/Users/csatt/GitHub/IV_Swinger/python3/./IV_Swinger2_gui.py", line 2977, in populate_tree
if not os.listdir(full_path):
^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 1] Operation not permitted: '/Volumes/MY_USB/.Trashes'

Need to catch that exception and skip that directory.

csatt added a commit that referenced this issue Apr 14, 2023
Add try/except around call to os.listdir and treat PermissionError the same as an empty directory.

Also fix a couple lint warnings from previous commit.
@csatt csatt closed this as completed Apr 14, 2023
@csatt csatt self-assigned this Apr 14, 2023
@csatt csatt added the bug label Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant