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

StackOverflow https://stackoverflow.com/questions/11874913

  •  25-06-2021
  •  | 
  •  

Вопрос

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.

Это было полезно?

Решение

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\'}');
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top