Python Forum
Integrating Python Debugging with Visual Studio Code in a Custom Application
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Integrating Python Debugging with Visual Studio Code in a Custom Application
#1
I’ve integrated Python directly into my application, running it within the same process by loading Python’s relevant libraries. I’m looking to debug Python code through my application’s Python interface using Visual Studio Code. After examining the debugpy module’s source code, which facilitates Python debugging in VSCode, I’m seeking guidance on how to configure my application.

Specifically, I want to be able to attach to my application’s PID using VSCode, ensuring that code executions triggered by my application will pause at breakpoints set in VSCode. How can I achieve this? How does attaching to a PID, getting its corresponding port number, interaction with VSCode, debugpy and Python work?
Reply
#2
I do this in Python for AutoCAD

I have a function that tells debugpy to listen
https://github.com/CEXT-Dan/PyRx/blob/ma...RxDebug.py

Then setup a config in VS code
https://github.com/CEXT-Dan/PyRx/blob/ma...ttings.txt

edit:
clients do something like this
 
# debug
def PyRxCmd_pydebug():
    import PyRxDebug
    PyRxDebug.startListener()
 
running the command starts the listener
Hope this helps
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020