I'm trying to follow this tutorial to customise iTerm2 with a Python script.
For the first step, it says to: "Select Scripts > New Python Script". I have a Scripts item in my top menu bar, but clicking it doesn't do anything; there is no dropdown or anything.
Upon researching this, it seems as though the Scripts menu is populated by adding files to: $HOME/Library/Application\ Support/iTerm2/Scripts/AutoLaunch. So I've created a Python file there and copy pasted the first example from the tutorial into it:
#!/usr/bin/env python3
import iterm2
async def main(connection):
app = await iterm2.async_get_app(connection)
window = app.current_terminal_window
if window is not None:
await window.async_create_tab()
else:
print("No current window")
iterm2.run_until_complete(main)
Now, when I restart iTerm2, I can access the Scripts menu, but I get a notification saying that the script has failed. I've tried chmod 777 <filename> incase that was it, but I'm still getting the error. cat /var/log/system.log has no information either.
What can I do to get my Python script running when I start iTerm2?