Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
iPyTerm - AppleScript Based iTerm2 launcher for IPython
on run {input, parameters}
#!/usr/bin/osascript
-- Run ipython on a new iTerm (OS X version)
-- See http://www.iterm2.com/#/section/documentation/scripting
tell application "iTerm"
activate
set ipy to (make new terminal)
tell ipy
activate current session
launch session "Default Session"
tell the last session
set name to "IPython"
write text "ipython --pylab"
delay 2
write text "import numpy as np"
write text "import pandas as pd"
write text "from pandas import Series, DataFrame"
write text "np.set_printoptions(linewidth=120)"
end tell
end tell
end tell
return input
end run
@AstroMike

This comment has been minimized.

Copy link

commented Sep 24, 2018

Very useful script!

If you add &";exit" after the jupyter command, then after you Ctrl-C on the jupyter server, the shell will exit and the itTerm2 tab will close. This a little hassle of having to do this manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.