3

Is there a way to make a MacOS Python application (using Pillow and ImageGrab) request the Screen Recording Permission like other C++ applications can? See https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/requesting_authorization_for_media_capture_on_macos

The permissions change in Catalina and later prevents screen capture from working in Python applications. Maybe Pillow or Python itself needs some MacOS specific code to "request" the permission needed when not already there? Can this already be done from a Python application? I know Pillow has been updated to handle MacOS; thus not needing pyscreenshot anymore to reach all platforms. But neither application will request the needed permission if not available in MacOS. Instead, you simply get the desktop background image if the permission does not already exist. It is typical for other applications to give a pop-up requesting the permission when needed. Why not in Python also?

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
  • Raised as an issue in pyscreenshot but closed as I could not supply the solution. https://github.com/ponty/pyscreenshot/issues/87 – SurplusGadgets Mar 26 '23 at 12:02
  • Did find this objective C code method to accomplish it. But only shows use / binding to javascript in chromium. Not sure how to bind it into python? [mac-screen-capture-permissions](https://github.com/karaggeorge/mac-screen-capture-permissions) – SurplusGadgets Mar 26 '23 at 14:35
  • Another related question asked the same day as this one. See https://stackoverflow.com/questions/62444545/python-screen-shot-only-desktop-background-macbook-catalina/67906924#67906924 . – SurplusGadgets Mar 26 '23 at 14:46
  • Same question asked a few days before. But no answer there either. See https://stackoverflow.com/q/67848058/16176512 – SurplusGadgets Mar 26 '23 at 14:47

0 Answers0