ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
342 stars 36 forks source link

Standalone App Microphone Permission #461

Closed antvopilov closed 2 years ago

antvopilov commented 2 years ago

Hello! I'm trying to build a standalone app for recording Microphone audio, which uses the "pyaudio". However, after creating the application and launching it, the macOS does not ask for permission to use the microphone. At the same time, the launch of the console application is successful . What am I doing wrong?

ronaldoussoren commented 2 years ago

You have to add a key to the info.plist file to ask for permission, see https://developer.apple.com/documentation/avfoundation/capture_setup/requesting_authorization_for_media_capture_on_macos for details.

Something like this should work (untested):

from setuptools import setup

setup(
    ...
    options={
       "py2app": {
          "plist": { 
            "NSMicrophoneUsageDescription": "Application captures audio"
          }
      }
   }
)