SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Topic started by: jporkkahtc on August 09, 2018, 05:37:19 pm

Title: Python debugging
Post by: jporkkahtc on August 09, 2018, 05:37:19 pm
Is there a way to debug a python script when a workspace is loaded?

I normally have a big workspace loaded, mostly java code.
I occasionally write little python scripts - it would be really handy to be able to debug them without creating a project or closing down my current workspace - just start debugging the current *.py file.
Title: Re: Python debugging
Post by: patrick on August 09, 2018, 06:05:42 pm
Currently, there isn't a way to force that.  Two big things the debug support relies on are associated with the open project: the debug method (jdwp, pydbgp, etc...) and the actual target named "debug" in the project.

It might be possible to add the ability to do it in the future.  I'd guess it wouldn't be hooked into F5, but you'd have to run some command or menu item explicitly that says "Just debug this script file".
Title: Re: Python debugging
Post by: Dennis on August 09, 2018, 09:59:41 pm
You might be able to use Debug > Attach Debugger > Attach to pydbgp...
Title: Re: Python debugging
Post by: jporkkahtc on August 14, 2018, 07:39:57 pm
Maybe, but as I remember this is a PITA to do it that way.

MSFT Visual Studio Code: You can setup multiple configurations.
Each configuration identifies the type (python, js, others?)
The path to the script to debug.
The Arguments to use when starting the script.

This is a *much* better way that Slick currently has.

I have to do Build->Python Options and set the correct version of Python to use.

Then to edit the script arguments I can set them in Project Properties, where the arguments are mixed in with stuff necessary for Slick
Code: [Select]
%(SLICKEDIT_PYTHON_EXECUTE_ARGS) "%f" %~other ....My args go here ...Or use Debug->Start with Arguments.

But, then I also have to be careful to set the correct *.py file as the current file or I start debugging in some random library *.py file from the last debug session.

Overall, a lot less than ideal.
Title: Re: Python debugging
Post by: Clark on August 15, 2018, 05:50:16 pm
We're always trying to figure out ways to simplify things. There's definitely room for improvement.

This could be a dumb question. I added two configurations to Visual Studio Code after opening a folder. How do you choose which one configuration is active? I ended up deleting one to debug with the configuration I wanted. I'm sure there's a better way but how?
Title: Re: Python debugging
Post by: jporkkahtc on August 15, 2018, 07:48:17 pm
View -> Debug.
Then there is a debug toolbar with a dropdown to select the profile.
Title: Re: Python debugging
Post by: Clark on August 16, 2018, 12:27:35 am

I like how the options the user sets are in one place. I like how execute and debug use the same command line options. Not a fan of brackets, braces, commas, and you better not make a mistake.
Title: Re: Python debugging
Post by: jporkkahtc on August 16, 2018, 06:57:19 pm
Yeah - its a cheat - adding a feature and avoid creating a bunch of UI to support it, just make the user edit a config file.
Title: Re: Python debugging
Post by: Clark on August 19, 2018, 11:40:39 pm
We've wanted to make the project properties dialog a tree (like Tools>Options) and combine the project options and the project properties. That would also give us more flexibility to move things around to make it easier to set common settings (and find settings --there are tons).

The Run/Debug settings should be cleaned up and simplified. Maybe put the Run settings on a separate tab even though some are used for Debug. The Python program arguments have a munge of arguments right now. Another simplification would be to separate the program arguments from other arguments (the Project Options Run tab already does this).

You can already copy a config but you can't insert say a C++ config in a Python project. I think that's doable. It's not that valuable though because you can simply add another project to your workspace and quickly switch to it. Although, it does require another project file.