Python in TextMate - run script in IDLE?
Is it possible for TextMate to run Python scripts in IDLE instead of internally or via terminal?
Rather than just using the Python assembly that comes with the IDLE installation, I want the shell window to actually start, so I can enter an interactive session.
I had a game on OSX and I think it works for me.
Open the TextMate text editor ( Bundles
→ Bundle Editor
→ Show Bundle Editor
)
Left side: Expand Python
, then duplicate the Run Script command (bottom corner, second left button [++]) and name it Run Script in IDLE
Select a keyboard shortcut and place it in the box next to Activation : Key Equivalent
Replace the following line:
TextMate::Executor.run(ENV["TM_PYTHON"] || "python", "-u", ENV["TM_FILEPATH"]) do |str, type|
from
TextMate::Executor.run("/usr/bin/idle2.7", "-r", ENV["TM_FILEPATH"]) do |str, type|
This supplies your file path as an argument to standby, as if you were running /usr/bin/idle2.7 -r /path/to/script.py
directly. (Or whatever version of python you are using - / usr / bin / idle3.1, etc.)
You can also use a flag -e
instead of a flag -r
to edit the Script in IDLE instead of running it.