You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working in a Python project organized as a module hierarchy. To execute a file path/to/file.py, I run it as python -m path.to.file in order to resolve relative imports correctly.
To debug this file, my launch.json config currently looks like this:
...plus another config for every new file I want to debug.
I would love to make a dynamic "Current file run as module from project root" launch config, and it seems to be very nearly possible, but not quite. The missing link is that I need a way to specify ${relativeFileDirname} using a period as the seperator instead of the normal path separator. If that could be achieved through either a new variable or some sort of modifier, it would improve the debugger a ton for projects structured this way!
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
Thank you for submitting your feature request and everyone who considered it! Unfortunately, this issue did not receive enough votes over the allotted time, and so we are closing the issue.
All good, thanks Brett Cannon (@brettcannon). Do you happen to have advice/feedback on how other users with a similar project config work around this issue? There could totally be something solution I'm missing here.
Best I can think of is having a top-level __main__.py for the package where you can specify arguments to choose which script you're running. And then you can use dynamic command-line arguments to choose which submodule you want to run.
Otherwise you could write a Python script to auto-generate an entry in launch.json for every submodule you have.
Activity
github-actions commentedon Jun 20, 2023
Thanks for the feature request! We are going to give the community 60 days from when this issue was created to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.
brettcannon commentedon Aug 24, 2023
Thank you for submitting your feature request and everyone who considered it! Unfortunately, this issue did not receive enough votes over the allotted time, and so we are closing the issue.
alecglen commentedon Aug 24, 2023
All good, thanks Brett Cannon (@brettcannon). Do you happen to have advice/feedback on how other users with a similar project config work around this issue? There could totally be something solution I'm missing here.
brettcannon commentedon Aug 28, 2023
Best I can think of is having a top-level
__main__.pyfor the package where you can specify arguments to choose which script you're running. And then you can use dynamic command-line arguments to choose which submodule you want to run.Otherwise you could write a Python script to auto-generate an entry in
launch.jsonfor every submodule you have.