Windows 10, Exec Node - Console appears. Can I hide it?

868 views
Skip to first unread message

Keith Kelly

unread,
Jul 21, 2017, 2:49:09 PM7/21/17
to Node-RED
I have exec nodes set up to run at a 15 minute interval:  

python "path_to_file.py"

A console window hijacks the screen each time this appears.  Can I make that stop?

I tried an approach by calling pythonw and/or renaming to path_to_file.pyw, but those didn't work either.  So, I'm thinking it's something about how the command is executed in Windows specifically.  

Julian Knight

unread,
Jul 22, 2017, 11:30:53 AM7/22/17
to Node-RED
Hmm, I don't remember seeing that issue before - can't think that I missed it?!

You can reduce the issue by using "start /B ...." as the command though you still get a window flash up temporarily.

AH!! Now I know why I missed it. Normally I run NR on Windows manually and that doesn't produce a new window. When you run NR as a service or via pm2, exec DOES pop up a window each time. Annoying.

I think that, to avoid this completely, you would have to create a new custom node to wrap around Windows functions. A couple of examples come from Edge.JS or the WinOle modules. You could call wscript for example from one of those modules which could then call your app.

However, if all you want to do is to run some Python code, try searching for Python in https://flows.nodered.org/ there are a couple of nodes that claim to be able to do that.

Julian Knight

unread,
Jul 22, 2017, 11:37:09 AM7/22/17
to Node-RED
A couple of other thoughts. 

It MIGHT be possible to do manually using Node's child_process https://nodejs.org/docs/latest/api/child_process.html#child_process.exec you would need to play around with that. You can reference it to your global variables in Node-RED's settings.js file. Try playing with PowerShell as the shell instead of cmd.exe as that has more options for running hidden processes.

It would also be possible to leave a python script running in the background - started with Windows using the scheduler - then send API-like calls to it - of course, it might also be easier to convert your Python code to JavaScript! Hard to say without knowing what you need to achieve.

Dave C-J

unread,
Jul 22, 2017, 11:52:37 AM7/22/17
to node...@googlegroups.com
Is this specifically a calling python on windows when running as a service thing or any command ?
--
Sent from phone.

Keith Kelly

unread,
Jul 22, 2017, 12:14:30 PM7/22/17
to Node-RED
I just tested with ping, and it happens there too.
Reply all
Reply to author
Forward
0 new messages