I've a Python package package_name
which provides a command line application command-line-app-name
as console_script
:
setup.py
:
setup(
...
entry_points={"console_scripts": ["command-line-app-name=package_name.cli:main"]},
...
)
The virtualenv is located in <project>/.venv
and managed with pipenv
. pipenv
managed venvs should support VSCode debugging integration. I've created a debugger configuration launch.json
file with setting the Python path to the venv (pythonPath
):
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: command-line-app-name",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"program": "command-line-app-name",
"linux": {
"pythonPath": "${workspaceFolder}/.venv/bin/python",
"args": ["-r", "/home/florian/gitlab/package_name/data/Test_MRM.d"]
},
"windows": {
"pythonPath": "${workspaceFolder}/.venv/Scripts/python.exe",
"args": ["-r", "D:\\MassHunter\\Data\\demo_0000.d"],
},
"console": "integratedTerminal"
}
]
}
The Windows and Linux specific venv python executable and command line arguments should not have an impact. If I run the debugger I get: FileNotFoundError: [Errno 2] No such file or directory: '/home/florian/gitlab/package-name/command-line-app-name'
. It seems like I'm miss-interpreting the documentation somehow. I tried to find help w.r.t. vscode-python as well as debugpy without success. How can I debug a console script command line app (instead of a package module)?