Debugging python code in VSCODE

ABOUT DEBUGGING CUSTOM NODE DEVELOPMENT


1. How to debug custom python code which is present inside js function for custom python node development in node-red. ?

2. How to use VSCODE debugging capabilities to debug node-red console errors ?

Hi, welcome to the forum.

I've moved your category from core development (which is about the development of Node-RED itself) to "Creating Nodes".

Also, you've managed to get all of your text in bold somehow which seems a bit "shouty" :slight_smile: It is hard to read for aging eyes like mine :frowning:


To answer your questions ...

You can't really. There is a node that lets you write Python in what looks like a function node (I've never used it). Or you can run external Python code via the exec node.

In the 2nd case, you can use standard Python tools if you know how to add a debugging interface to a Python app.

Node-RED is built on Node.js (JavaScript). Any connection to Python is incidental.

Another way to interface between the 2 would be to create a Python daemon (server) app - effectively a Python-based API server. Then with both that and Node-RED running, you could easily use the TCP, HTTP or Websocket features of Node-RED to communicate with your Python server. This is actually a lot easier than it sounds.

This has been written up a few times, try a search through the forum.

Here are a couple of my own related blog posts:

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.