LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
LabviewBow

Console for Python Node

Status: New

I am happy that LabVIEW supports Python code with the Python Nodes. But it is difficult to debug errors. A console showing the output of the Python Scripts would be handy.

Enthought's Python Integration Toolkit had this function so I guess it shouldn't be a big thing to add?

 

10 Comments
ChrisO0
Member

Same problem! Haven't you get an answer for this topic?

altenbach
Knight of NI

> Same problem! Haven't you get an answer for this topic?

 

This is the idea exchange and the above post is an idea for future improvements, not to solve a problem or get answers. If you want this idea to be considered, you should vote for it (click on the star in the upper left).

Christina_R
Active Participant

I'd like to get your feedback on an unpublished feature that's in LabVIEW 2018 and later. If you edit your INI file to contain "ShowConsoleForPythonNode=TRUE" then a window will open when a Python Node executes to show the output from Python. Would this functionality meet your debugging needs?


Christina Rogers
Principal Product Owner, LabVIEW R&D
LabviewBow
Member

Wow thank you Christina this very well,

 

this would have saved me so much trouble a year ago 😄

But still VERY usefull!!

 

Any other unpublished features you would like to share? 

 

Edit: The Python connection crashes when I close the console output window. But I guess that this is a known issue.

roodrood
Member

Hi, i just tried this by adding "ShowConsoleForPythonNode=TRUE" to my LabVIEW INI file but i do not see any console window opening in LabVIEW when a python node executes! am i missing something here? i am using LabVIEW 2023 Q3.

D*
Member
Member

The console window appears in LabVIEW 2022 Q3 with the .ini string.  I find it no longer appears in more recent versions. 😭

lucian.grec
Member

What are our options for debugging in LV2023? On AppleSilicon I can't get VSCode to attach to the process and this flag doesn't show the console anymore so I'm left with no way to debug my code.

Christina_R
Active Participant

It should no longer be necessary to use the console. Please refer to How to Debug Python Code Called From LabVIEW Python Node - NI.


Christina Rogers
Principal Product Owner, LabVIEW R&D
lucian.grec
Member

I agree that the debugger is better and I shouldn't need the console but as I mentioned in my initial post, I'm on Mac and the debugger doesn't seem to be allowed to connect to the process.
The link you provided works fine but it only describes the Windows side of things. On top of that I think that needing the LV environment in order to debug scripts is an incomplete solution at best. Our customers will write python plugins for our application and they won't have access to the source code. The only way I know then for someone in this scenario to connect the debugger is to add a long wait at the beginning of the python script so that the debugger has enough time to connect.

See bellow the error I'm getting from the latest VSCode, Mac mini M2, Python 3.9, latest LV 2023 Q3 and patch

--- Starting attach to pid: 57810 --- (lldb) process attach --pid 57810 error: attach failed: attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)

Christina_R
Active Participant

You might be running into Mac security preventing you from attaching to Python. Refer to [LLDB] attach failed,(Not allowed to attach to process.) · Issue #52829 · llvm/llvm-project · GitHub.

 

As far as I know, ShowConsoleForPythonNode still works on Windows, but there's no equivalent for Mac.

 

I apologize that there doesn't seem to be an easy solution for what you're building.

 

 


Christina Rogers
Principal Product Owner, LabVIEW R&D