Executing Python Code Within Komodo Edit

Posted by newbie73 on 2007-12-19 09:19

Just started using Komodo Edit and love it for Python script editing. I am looking for a way to execute python scripts from within Komodo Edit but have not been able to find this feature. Is it hidden or am I looking for some phantom feature here?


jeff.griffiths | Wed, 2007-12-19 09:52

There is no debugging feature in Komodo Edit but you can just run the current file by creating a Run Command:

1. go to Toolbox -> Add -> New Command...
2. in the top field enter the name 'Run Python file'
3. in the 'Command' field enter this text:

%(python) %F
3.a optionall click on the 'Key Binding' tab and assign a key command to this command
4. click Ok.

You should now have a new Run Command in your toolbox called 'Run Python file'; when you double-click on it the command should run the current Python script open in the editor and display the output in the Command Output pane.

For more on Run Commands:



sushmitasahu | Sun, 2009-10-18 09:20

i wrote an interactive piece of python code which takes input from user. I have followed all the processes to run python command from komodo edit as told by you.
But when i run the interactive code it says .. running the but never finally excutes it.
Can u help me in this..
Also would like to know if this editor has any short cut for giving the list of commans or the declared variables.. like other editors example eclipse for java code..
Thanks and regards

vlc | Wed, 2011-06-01 17:56

my script runs but if I include a line such as val = input('Enter a number: ')
no dialogue is visible.

ActiveState Staff
Thu, 2011-06-09 11:40

Ensure you pass the "-u" (unbuffered input/output) option to your Python interpreter.

%(python) -u %F


etank | Fri, 2008-11-14 07:43

If you are on Windows and the path to the file that you want to run has spaces in it then you may want to change the command to

%(python) "%F"

The "" will allow it to work.

revs | Thu, 2009-06-11 07:25

you may also want quotes around the %python is there are spaces in the python path, e.g.

"%(python)" "%F"

ollied77 | Sat, 2010-06-19 06:08

Just installed Komodo edit and trying to get this to work. I have set up a new command as described. It works for scripts that print stuff out. I can see this is the command output. But if I try and use raw_input in the script, the command window does not display anything. I can type into the window but this will never get passed into the raw_input.

Thanks for any advise you can give.


ActiveState Staff
Mon, 2010-06-21 11:39

Hi Ol,

You'll need to ensure your running Python in unbuffered io mode. See here for the full details:


ollied77 | Sun, 2010-07-04 13:46

Hi Todd,

Thanks that has done it. I am now using komodo edit nicely.

Might you be the same Todd Widup that taught me how to script with Mel several years ago in a CG Society workshop? That was a great course, kick started me into scripting. Never looked back. Thanks Dude (if it is indeed you):)


ActiveState Staff
Mon, 2010-07-05 11:25

Heh, nope, I've never done any Mel scripting, must be some other :)

ollied77 | Tue, 2010-07-06 14:24

Ah my mistake!

crazyivan | Wed, 2011-01-19 16:07

The instructions above are for, I believe, a slightly older version of Komodo Edit, and I'm having trouble making them work.

In Komodo Edit 6.0.3, running in Mac OS X, I'm doing the following:

Tools -> Run Command

In the window that comes up:

In the "Run:" section, I'm typing %(python) %F
I'm selecting or changing no other advanced options, save for changing "Run in:" to New Console.

When I hit Run, Terminal starts up, there something flashing for way less than a second, presumably output, which is then replaced by "Press RETURN to continue..." which leads me to a logout and process complete message.

Any idea what's going wrong?

eparent | Thu, 2013-01-17 08:26

Hi all,

I'm using Komodo IDE, version 7.1.3, build 74661, platform win32-x86. Built on Tue Oct 30. Running on Win 7 64 bits, using Python 2.7.2 64 bits (Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32).

My intention is to get my code under development running on a console, pretty much like if I would be hitting "F5" on Idle. Based on these the current post, I'm running this command (Tools > Run Command):

%(python) -u -i %F

And I get this strange output when I just ask about some variables that are defined in the currently loaded script:

# begin of Command Output
>>> slope

>>> Parameters
'wood': {'slope': 0.00079611650485436895, 'offset': -0.19631067961165075}, 'rock': {'slope': 4.8543689320388455e-05, 'offset': 0.27388349514563071}}
# end of Command Output

It seems like the prompt is broken somehow and there are some extra spaces being added in the display.

Haven't noticed anything strange yet other than weird display.

Is there anything I should do to fix that?

NB: It does the exact same thing in Komodo Edit 7.1.


- Eric

ActiveState Staff
Thu, 2013-01-17 14:03

Any chance of seeing the file it's self? If it's private you could create a bug report here http://bugs.activestate.com/enter_bug.cgi?product=Komodo and we can make the attachment private.


- Carey