Valendar Turner
Valendar Turner

Reputation: 63

Create a New Command or Macro in Komodo 7.1 IDE to save and run a python file

How can I create a New Command or Macro in Komodo 7.1 IDE to save and run a python file?

I want the output to go to a New Console. Not the Command Output Tab.

Upvotes: 1

Views: 551

Answers (1)

Paul Sweatte
Paul Sweatte

Reputation: 24637

If you put:

import code
code.interact(local=locals())

in your program, then you will be dumped to a python interpreter. (See Method to peek at a Python program running right now).

Use doCommand and runEncodedCommand to save and run the python file respectively:

komodo.assertMacroVersion(3);
if (komodo.view && komodo.view.scintilla) { komodo.view.scintilla.focus(); }
komodo.doCommand('cmd_save')
ko.run.runEncodedCommand(window, '/usr/local/bin/pythonw3 \"%F\" {\'cwd\': u\'%D\'}');

Upvotes: 1

Related Questions