Author Topic: Python debugging  (Read 1172 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1849
  • Hero Points: 179
  • Text
Python debugging
« 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.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1136
  • Hero Points: 107
Re: Python debugging
« Reply #1 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".

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2815
  • Hero Points: 426
Re: Python debugging
« Reply #2 on: August 09, 2018, 09:59:41 pm »
You might be able to use Debug > Attach Debugger > Attach to pydbgp...

jporkkahtc

  • Senior Community Member
  • Posts: 1849
  • Hero Points: 179
  • Text
Re: Python debugging
« Reply #3 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.
etc.


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.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4933
  • Hero Points: 403
Re: Python debugging
« Reply #4 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?

jporkkahtc

  • Senior Community Member
  • Posts: 1849
  • Hero Points: 179
  • Text
Re: Python debugging
« Reply #5 on: August 15, 2018, 07:48:17 pm »
View -> Debug.
Then there is a debug toolbar with a dropdown to select the profile.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4933
  • Hero Points: 403
Re: Python debugging
« Reply #6 on: August 16, 2018, 12:27:35 am »
Thanks

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.

jporkkahtc

  • Senior Community Member
  • Posts: 1849
  • Hero Points: 179
  • Text
Re: Python debugging
« Reply #7 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.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4933
  • Hero Points: 403
Re: Python debugging
« Reply #8 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.