1

I have a python library in github I want to debug. The library has setup.py as well as a pip released package. So I can install this module using either pip install git-sim or python3 setup.py install.

This module adds a command to the path and I can execute in terminal with git-sim .

Main Problem: I want to clone the github repo and open vscode inside the cloned repo and debug the code getting executed while I am running the command from the terminal. The breakpoints should hit the file inside the repo.

Link to the github Repo: https://github.com/initialcommit-com/git-sim

I went searching with these requirements. Best I could come up so far is

  1. An edit mode in setup.py which can be started by pip install -e . . While I ran this command and was successful I did not see a way to debug it.
  2. How do we debug a module in Vscode? Give this code in launch.json
    {
        "name": "Python: Module",
        "type": "python",
        "request": "launch",
        "module": "git-sim",
        "justMyCode": false,
    }

But while I am running this I am getting an error, no module named git-sim even though the same command works outside the debugger in the terminal. i.e both git-sim and python3 -m git_sim

Any suggestion of where I maybe going wrong? Or if there is some alternative option I have not considered

1 Answer 1

1

Found the issue. I made a mistake in assuming the terminal command git-sim and the actual python -m git_sim were same.

Module Name and Terminal commands are different. So if we modify launch config from "module":"git-sim" to "module":"git_sim" it works. Modified config given below:

{
    "name": "Python: Module",
    "type": "python",
    "request": "launch",
    "module": "git_sim",
    "justMyCode": false,
}
Sign up to request clarification or add additional context in comments.

1 Comment

Hi, @MingJie-MSFT Thanks for the reply. Waiting for the completion of 48 hours window to accept my own answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.