0% found this document useful (0 votes)
160 views2 pages

Setting Up VS Code For Debugging

VS Code can be used to debug Python code running in a WSL environment. To set this up: 1. Install the Remote - WSL extension in VS Code and use it to open a new window connected to the WSL environment. 2. Open the ERPNext directory in the remote window and install the Python extension. 3. Configure the Python interpreter to match the one used by ERPNext. 4. Create a launch configuration file to enable debugging and set breakpoints in the Python code. 5. Start debugging by running code with breakpoints and inspecting variables when execution pauses.

Uploaded by

Rio Pramana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views2 pages

Setting Up VS Code For Debugging

VS Code can be used to debug Python code running in a WSL environment. To set this up: 1. Install the Remote - WSL extension in VS Code and use it to open a new window connected to the WSL environment. 2. Open the ERPNext directory in the remote window and install the Python extension. 3. Configure the Python interpreter to match the one used by ERPNext. 4. Create a launch configuration file to enable debugging and set breakpoints in the Python code. 5. Start debugging by running code with breakpoints and inspecting variables when execution pauses.

Uploaded by

Rio Pramana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Setting Up VS Code for Debugging:

1. Install the "Remote - WSL" Extension:


 Open VS Code on your Windows machine.
 Go to Extensions (or press Ctrl+Shift+X ).
 Search for "Remote - WSL" and install it.
2. Connect to WSL from VS Code:
 In VS Code, click on the green icon in the bottom-left corner.
 Choose "Remote-WSL: New Window" to open a new VS Code window
connected to WSL.
3. Open ERPNext Directory:
 In the new VS Code window, go to File > Open Folder.
 Navigate to the directory where ERPNext is installed and open it. This will
allow you to browse the ERPNext codebase directly in VS Code. Typically,
the directory would be something like /home/your_username/frappe-bench .
4. Install the Python Extension:
 In the VS Code window connected to WSL, go to Extensions.
 Search for the "Python" extension by Microsoft and install it. This
extension provides enhanced support for Python within VS Code, including
debugging capabilities.
5. Configure Python Interpreter:
 Press Ctrl+Shift+P to open the command palette.
 Type "Python: Select Interpreter" and select it.
 Choose the Python interpreter that's used by your ERPNext installation. It's
usually located within the frappe-bench environment.
6. Set Up Debugging:
 In the left sidebar of VS Code, click on the Run icon (a play button with a
bug on it).
 Click on "create a launch.json file" link.
 Choose "Python File" from the dropdown. This will create a launch.json file
with default configurations for debugging Python files.
 Now, you can set breakpoints in the ERPNext Python code by clicking on
the left margin next to the line numbers. When you run the code in debug
mode, the execution will pause at these breakpoints, allowing you to
inspect variables, step through the code, and use other debugging
features.
7. Run & Debug:
 Open the Python file you want to debug.
 Set breakpoints where needed.
 Press F5 or click on the green play button in the top-left to start
debugging.

Now, you're all set to debug ERPNext's Python code using VS Code. As you explore the
codebase, you can use VS Code's debugging features to gain a deeper understanding of
how ERPNext works.

Let me know if you encounter any issues during the setup or if you have any other
questions!

You might also like