I'm using Komodo 5.2.2 on OS X, working on a Python project. When I invoke the debugger via Debug > Go/Continue, I'd like my main application script to run instead of whatever's open. I've set the "Script" setting in the Project Properties and Settings > Debug Session Startup to the full path of the script I want to run, but Komodo still runs the file that's open. Can anyone suggest a fix?
Also, I've become used to having files open automatically when they're selected in the project pane, rather than requiring a double-click to open - is there a way to have Komodo behave that way?
Thanks!
The debugging dialog always initializes itself with the current editor file. To change this, I'd suggest to write a Komodo macro to do what you need, here is a simplistic example below:
ko.open.URI("file:///Users/me/projects/foo.py")
ko.commands.doCommand("cmd_dbgGo")
// Switch to a specific file and launch the debugger ko.open.URI("file:///Users/me/projects/foo.py") ko.commands.doCommand("cmd_dbgGo")As for the project single-click to open a file, Komodo does not offer this by default - you'd have to write an extension to overlay the project tree - adding a single click handler.
Cheers,
Todd
Thanks, Todd - I tried your suggestion, but it doesn't seem to work. It does switch focus to my main file, but it still runs whatever had been open when I pressed the shortcut key. Is there a workaround? Thanks!
Sorry about that, I'd overlooked the fact that the ko.open.URI method is asynchronous. Try this instead:
ko.open.URI("file:///Users/me/projects/foo.py", null, null, function() {
ko.commands.doCommand("cmd_dbgGo");
});
// Switch to a specific file and launch the debugger ko.open.URI("file:///Users/me/projects/foo.py", null, null, function() { ko.commands.doCommand("cmd_dbgGo"); });The above code uses a callback after switching to the new file.
Cheers,
Todd
Thanks, Todd - I figured there was some sort of race going on there.
Is it possible to have the macro refer to the "Script" setting from the ""Debug Session Startup" dialog, rather than hardcode the script name in the macro? Seems like that'd make it reusable and suitable for the toolbox rather than project-specific.