Showing posts with label Komodo Edit. Show all posts
Showing posts with label Komodo Edit. Show all posts

Monday, July 14, 2008

Komodo Edit save and run python macro

Komodo Edit is a good editor for many programming language. However, since it is free as compared to its brother Komodo IDE, there is lack of debugging function. But, Macro and run command do exist though. You can make use of those feature to save and debug your script with a click of a shortcut key.

Step 1: Create a new macro.


Step 2: Enter the macro script below.

if (komodo.view) { komodo.view.setFocus() };
komodo.doCommand('cmd_save')
ko.run.runEncodedCommand(window, '%(python) -O \"%F\" {\"cwd\": u\"%D\"}');
You are free to change %(python) to %(perl), provided that perl is installed, and the environment path is set.

Step 3: Set a key binding to the new created macro.


Now you just need to press the 'F5' key inorder to save and run a python script.

Tuesday, July 8, 2008

Executing Python Code Within Komodo Edit

Komodo Edit is a good free editor for Python development. However, there is no debugging feature in Komodo Edit. Therefore, it is a cumbersome process to execute Python scripts. Fortunately, there is a feature called Run command to satisfy this job.

To make use of the Run command feature to execute Python code, you can follow these steps:
  1. click Toolbox > Add > New Command.
  2. type "Run Python file" in the top field.
  3. enter in the command field,
    %(python) "%F"
  4. Click on the "Key Binding" tab and you can set the keyboard shortcut key (optional). I personally like the F5 key.
  5. Click OK.
Now, you can easily execute the Python script by pressing "F5", or by double clicking the "Run Python file" in your toolbox pane, which is usually located at the right. The output will be displayed in the Command output pane at the bottom.

For more information on the "Run Command":

http://aspn.activestate.com/ASPN/docs/Komodo/4.4/run.html