37

I'm using Visual Studio Code for writing my python application. Inspecting variables and things like setting a watch in the left debugging pane works OK if I write a simple synchronous one-file program.

However, I have code with classes in multiple files, and use various callbacks from other modules. Some which start a new thread.

One of those modules is canopen I can step thru my code, but when I enter the second line (below)

can0 = canopen.Network()
can0.connect(channel='can0', bustype='socketcan')

then the call stack changes from:

CALL STACK paused on breakpoint
main
<module>

to

CALL STACK paused on breakpoint
MainThread
Thread#15034.........

and simultaneously

  • the variables pane clears
  • and the watches in my watch window shows:

    can0: not available

How can I (setup VS studio code with Python to) inspect/debug my python code with various threads and code in various files?

Regards, Bas

2 Answers 2

4

New debugger is capable of debugging async applications. Check out how to set it up How to update ptvsd used by Visual Studio Code in debug mode And don't forget to add "subProcess": true, in launch.json

Sign up to request clarification or add additional context in comments.

Comments

1

Set the debug to works with Visual Code.

You can see a good article about how you can set the debugger here and here, see:

The setting "stopOnEntry":true will cause the debugger to break at the first line of the python program being debugged. If this is not desired, then change the value from true to false. The default value of this setting is true.

Comments

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.