I am using a Macbook Air on Big Sur 11.2.2, with language set to Japanese.
I was trying to launch "reminder.app" using subprocess.Popen( ) on Python 3.8.5. interactive shell. But I am unable to launch the Reminders.app even if I use the Japanese app name indicated (along with Calculator.app , Dictionary.app and many others that are shown in Japanese app names). I am however able to launch apps I installed.
>>> import subprocess
>>> subprocess.Popen(['open', '/Applications/Reminders.app/'])
<subprocess.Popen object at 0x7ffa8e233e80>
The file /Applications/Reminders.app does not exist.
>>> subprocess.Popen(['open', '/Applications/リマインダー.app/']) # Japanese name of app
<subprocess.Popen object at 0x7ffa8e233d60>
The file /Applications/リマインダー.app does not exist.
subpsubprocess.Popen(['open', '/Applications/Safari.app/'])
<subprocess.Popen object at 0x7ffa8e233bb0>
# success!
I have checked using Finder, and all the applications I am looking for are shown in the GUI interface, albeit given Japanese names. However, these apps simply cannot be found on terminal command line nor manipulated, even with ls -a
.
How can I find the path to the Reminders app, with the intent of using it with subprocess.Popen() ?
Is it not possible to do so because I am using a non-English system language?
If you want to launch it, rather than just find it, you can try this command line:
osascript -e 'tell application "Reminders" to activate'
I don't know if you can substitute the Japanese name, but it's worth a try. So from Python:
import os
os.system('osascript -e \'tell application \"Reminders\" to activate\'')
or
import subprocess
subprocess.Popen(['/usr/bin/osascript', '-e', 'tell application \"Reminders\" to activate'])
The osascript
command is basically running the small AppleScript in the single quotes. I haven't tried doing anything more complicated, but I assume, being an Apple program, that it supports all sorts of AppleEvents so you can probably do cool things like actual schedule a reminder using an AppleScript from your Python code.