-
Notifications
You must be signed in to change notification settings - Fork 89
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
Screen capture in MacOS #87
Comments
I have no Mac, but I accept Mac-specific code if it is in the project's scope. |
Did find this objective C code method to accomplish it. But only shows use/ binding to javascript in chromium. How to bind into python? mac-screen-capture-permissions Did make a request way back when on stackoverflow but no response there either. can-you-request-the-macos-screen-recording-permission-in-python |
I followed your links and the solution is here: |
That "solution" is not a programmatic one. It requires a user to setup their MacOS System Preferences to allow the screen capture. See my comment at [How to check App permission in mac os | python which has a link to a user manual image I added which describes how to do that. But when do users ever look at the manual :) As indicated in the post shown above, am looking for a programmatic solution. If even just to generate a pop-up to the user that they need to enable the permission. It appears the code to determine if the permission is there and the code to request the OS generate the pop-up to set the permission are pretty much one in the same. So it would be nice if pyscreenshot could use the Objective C code pointed to above. (Do not recall if you have the "pip" construct method to include binary libraries or Objective C code that is linked to python). Python itself, or a terminal it starts from, do not ever cause this OS level pop-up when the screen capture is initiated from pyscreenshot inside a python program. So, today, a user never knows that this is an issue or that there is even an issue to resolve. Just the user gets blank screen captures. |
|
The other mentioned Python libraries have not incorporated this MacOS change, MacOS applications are supposed to provide the pop-up to allow the user to change permissions. Unfortunately, the way Python is implemented, the pop-up is initiated for Terminal only and not the Python interpreter as well. I believe the mentioned packages have non-Python code as part of their PIP installation; it becomes a requirement to have XCode installed on MacOS for some PIP library configures. We are a pure python application on a very wide array of platforms (as it sounds like your package may be). So only chance for non-python code is in PIP-installed libraries. (We would simply distribute with BioConda but they do not support Windows which nearly 1/2 our users are on. So we do compile and distribute bioinformatic tools as a distinct and separate function at the moment. Once we get the msys package manager to include all we need; we will drop the separate port / distribution of Windows bioinformatics tools and likely distribute as BioConda on most platforms. Native Win executables are still faster than WSL2/G.) |
See https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos
A Mac-specific code, maybe in PIL or the Python Launcher itself, needs to be added to allow the app to request the screen capture permission BEFORE the code will work on Apple MacOS Catalina or later. As none of the other solutions work on all platforms (Linux, Win10, MacOS), it would be nice if you could get this fix pushed through (or integrated into your code if possible).
The text was updated successfully, but these errors were encountered: