Sublime Forum

Custom Key Bindings stopped working - 'osascript' not found

#1

I have custom key bindings set to have ctrl+k push code chunks to iTerm. It was working about a week ago and all of a sudden doesn’t anymore. Here’s the error I see:

Traceback (most recent call last):
  File "/Users/kestrella/Library/Application Support/Sublime Text 3/Packages/SendCode/send_code.py", line 88, in <lambda>
    sublime.set_timeout_async(lambda: sender.send_text(cmd))
  File "/Users/kestrella/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/sender.py", line 96, in send_text
    self.send_to_iterm(cmd)
  File "/Users/kestrella/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/sender.py", line 49, in send_to_iterm
    send_to_iterm(cmd, bracketed=self.bracketed_paste_mode)
  File "/Users/kestrella/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/iterm/__init__.py", line 12, in send_to_iterm
    osascript(ITERM, cmd, str(commit))
  File "/Users/kestrella/Library/Application Support/Sublime Text 3/Packages/SendCode/code_sender/applescript.py", line 5, in osascript
    subprocess.check_call(["osascript"] + list(args))
  File "./python3.3/subprocess.py", line 542, in check_call
  File "./python3.3/subprocess.py", line 523, in call
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1448, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'osascript'
0 Likes

#2

The basis of that particular error looks to be that osascript can’t be found on the PATH. Generally that should not be a problem since it’s in /usr/bin which should be on the PATH by default.

Have you done anything recently that might have modified what the PATH is?

0 Likes

#3

It’s definitely on PATH in my .bash_profile. Is Sublime using those same path settings?

0 Likes

#4

Generally speaking yes. Sublime on MacOS has specific handling for this because on that OS programs inherit the environment of the launch daemon and not what’s in your shell.

To get around that Sublime spawns a shell in the background at startup to capture the environment. That can fail if the shell takes too long to return the result back. However unless you also installed something recently that modified your bash config files, that is unlikely to be the issue.

Still, I believe up near the top of the console you should see a message about it either getting the config or giving up, so that could be a troubleshooting step.

0 Likes