[Python] How to check App permission in mac os | python

Discussão em 'Python' iniciado por Stack, Fevereiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am a new Mac User.

    I am making a Python Application which takes screenshots. It works perfectly in Linux and Windows. When I open my app (in Mac); I noticed that I have to give permission in System Preferences > Security & Privacy > Screen Recording and then allow apps to record screen.

    I turned Screen Recording on and after a while I turned it off. Now when I reopened my app, Mac did not asked the prompt if I have to give rights. And also it was not able to access Screen.

    Well, how can I check if user has enabled the permission in python? Something like this.

    file.py

    if check_permission():
    perform_task()
    else:
    if ask_permission:
    perform_task()
    else:
    print("You do not have enough rights")


    Correct me if I am wrong. I am new to Mac. Any help is appreciable. Thanks in advance :)

    Continue reading...

Compartilhe esta Página