You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unable to Execute reminders-cli Commands in VS Code Terminal on macOS #58
I am having difficulty executing reminders-cli commands through the integrated terminal in Visual Studio Code (VS Code) on my macOS system. While the commands work perfectly in my system's terminal (zsh), I encounter an issue when running the same commands in the VS Code terminal. The error message states "You need to grant reminders access".
I have checked the PATH in both terminals and they are identical. I have also ensured that the default shell for VS Code is set to zsh. However, the problem persists.
When I attempt to run my Python script which uses subprocess to call reminders-cli, I get the following error message:
Exception has occurred: CalledProcessError
Command '['reminders', 'show-lists']' returned non-zero exit status 1.
File "/Users/myusername/workspace/reminders/myscript.py", line 6, in myfunction
lists_output = subprocess.check_output(['reminders', 'show-lists'], text=True)
File "/Users/myusername/workspace/reminders/myscript.py", line 34, in<module>myfunction()
subprocess.CalledProcessError: Command '['reminders', 'show-lists']' returned non-zero exit status 1.
I understand from the error message that I need to grant access to reminders, which I did through the "Security & Privacy" settings in macOS for my terminal. However, VS Code does not appear on the list of apps that can be granted access to reminders, and no prompt appears when I run reminders-cli commands in the VS Code terminal to allow access.
Any guidance on how to resolve this issue would be greatly appreciated. Thank you in advance for your time and assistance.
importjsonimportsubprocessdefget_reminders():
script=""" set allReminders to {} tell application "Reminders" set reminderLists to every list repeat with aList in reminderLists set listName to name of aList set listReminders to {} set remindersInList to every reminder of aList repeat with aReminder in remindersInList set end of listReminders to name of aReminder end repeat set end of allReminders to {listName:listReminders} end repeat end tell return allReminders """process=subprocess.Popen(['osascript', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr=process.communicate(script.encode())
# 注意:AppleScript 返回的数据格式可能需要额外处理才能正确解析为 JSONreminders=json.loads(stdout.decode())
returnremindersdefwrite_reminders_to_file():
reminders=get_reminders()
withopen('reminders.json', 'w') asf:
json.dump(reminders, f)
write_reminders_to_file()
Activity
keith commentedon Apr 28, 2023
Can you manually add VS Code to that list? 🤔
epodak commentedon Apr 28, 2023
I constructed an apple script to read reminders requests to solve this problem.
epodak commentedon Apr 28, 2023
apple script