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

Unhandled PermissionError in autoload.py on macOS Mojave due to walking the filesystem #271

Closed
rben01 opened this issue Jul 31, 2018 · 1 comment

Comments

@rben01
Copy link

rben01 commented Jul 31, 2018

In macOS Mojave, Apple has introduced a permissions system for the data in a user's home folder. With this system, the user may grant or deny permission for an app to access certain sensitive pieces of user data. The sensitive areas mirror what's on iOS and protected data includes Contacts, Calendars, Photos, etc. If the user denies an app permission to access these areas, all operations that the app performs on them, or the folders containing that data, will fail.

When prospector starts up, it does a walk of the user's (current working?) directory, and may attempt to access files that the controlling program (a GUI editor, say) doesn't have permission to access -- especially if the directory is ~. When this happens, instead of failing gracefully, prospector has a hard crash due to the PermissionError caused by attempting to walk through denied directories such as ~/Pictures/Photos Library.photoslibrary.

Here is a sample stack trace:

Traceback (most recent call last):
  File "/opt/miniconda3/bin/prospector", line 10, in <module>
    sys.exit(main())
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/run.py", line 154, in main
    config = ProspectorConfig()
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/config/__init__.py", line 34, in __init__
    self.libraries = self._find_used_libraries(self.config, self.profile)
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/config/__init__.py", line 169, in _find_used_libraries
    map(libraries.append, autodetect_libraries(self.workdir))
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/autodetect.py", line 94, in autodetect_libraries
    libraries = find_from_path(path)
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/autodetect.py", line 51, in find_from_path
    names |= find_from_path(item_path)
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/autodetect.py", line 51, in find_from_path
    names |= find_from_path(item_path)
  File "/opt/miniconda3/lib/python3.6/site-packages/prospector/autodetect.py", line 46, in find_from_path
    for item in os.listdir(path):
PermissionError: [Errno 1] Operation not permitted: '/Users/rben01/Pictures/Photos Library.photoslibrary'
carlio added a commit that referenced this issue Feb 27, 2022
…skip it if it is in the list of ignored paths)
@carlio
Copy link
Contributor

carlio commented Feb 27, 2022

This is an old bug but it's probably the same underlying cause as #487 which is now fixed as of prospector 1.7.2

@carlio carlio closed this as completed Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants