Check the OS running the script with platform.system ()
and throw ʻosascript -e'display notification" hoge "'to the shell. For macOS,
platform.system ()will be replaced with
'Darwin'`.
python
import os,platform
def main():
if platform.system() == 'Darwin':
os.system("osascript -e 'display notification \"This is a mac\"'")
if __name__ == '__main__':
main()
References:
--platform – Access system version information --Python Module of the Week -Notify Mac Notification Center from Python --Qiita
Recommended Posts