# Pythonshell exit code -4508

**URL:** https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990
**Category:** General
**Created:** [4 April 2024 00:54 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990 "2024-04-04T00:54:23Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![New\_to\_node\_red](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@New\_to\_node\_red](https://discourse.nodered.org/u/New_to_node_red)
#### Post date: [4 April 2024 00:54 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/1 "2024-04-04T00:54:24Z")

</div>

I have been having this issue that python command is not found/ python install not found.

I have added python folder to the Path variable. I am working with windows system.

"the Path in node-red must be different to path from the terminal." -- past post.

I believe my issue is related to this.

When I navigate to my file folder and execute python example.py, it runs. However, when I execute the same file from node-red it gives me a -4508 error code, python install not found.

example.py is within the node-red folder.

How can I change the path to python in node-red? I executed some bash scripts but I had to "set PATH=.../python" before executing some python commands like creating a venv and using pip.

Since I am trying to execute a .py file, I cannot use set PATH. If there is an alternative that I am unaware of that works within the .py file please let me know.

Using exec is not possible since I have continuously incoming payload which needs to be fed into the .py. Incoming payload size ~500kb  
If it is possible to use exec, please suggest a way to handle continuously incoming payload.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [4 April 2024 14:52 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/2 "2024-04-04T14:52:26Z")

</div>

You would have to set the path in the environment that node-red is running in, but I see from the node's github page that there are [a number of unnadressed issues](https://github.com/namgk/node-red-contrib-pythonshell/issues). It appears that the node is abandoned.

If I were doing this I would probably run the python script as a separate process and communicate with it via MQTT. Even better would be to translate the python into node-red nodes if possible.

---

<div class="post-metadata">

### Author: ![New\_to\_node\_red](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@New\_to\_node\_red](https://discourse.nodered.org/u/New_to_node_red)
#### Post date: [10 April 2024 16:39 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/3 "2024-04-10T16:39:39Z")

</div>

That's alarming.

I will try to investigate a different way to approach my problem without python.

Essentially, I am trying to do ML/data analysis for continuously incoming real-time series data. Any suggestions on which nodes/modules/collections would be able to help me best?

I am currently looking at the node-red-machine learning module and ML collection.

Question: _a little out of context in terms of this post_ Is there a way that an external model can be stored within the node-red instance and inferencing can be done within node-red env?

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [10 April 2024 18:05 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/4 "2024-04-10T18:05:21Z")

</div>

If you already have an external model and working code around that, why not do the inferencing in that external module/process and then simply provide the result to node-red for further handling like presentation etc? Re-working, is it wort he effort?

Javascript is maybe not the best choice for heavy calculations, sometimes also needing the power of GPU's to get a decent performance. But it might be, node.js may have some new things that I'm not aware of.

As example, I have an external Python process running in a NVIDIA computer that does object detection using YOLO and sending the results back to node-red via MQTT (same as @Colin suggested). I have no further plan to migrate something that since years has proved to work rock solid

---

<div class="post-metadata">

### Author: ![New\_to\_node\_red](https://avatars.discourse-cdn.com/v4/letter/n/aca169/32.png) [@New\_to\_node\_red](https://discourse.nodered.org/u/New_to_node_red)
#### Post date: [15 April 2024 17:32 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/5 "2024-04-15T17:32:22Z")

</div>

I see. I appreciate your and @Colin suggestions. I will take a look into MQTT. Thanks for clearing some of my doubts.  
I will first try to implement the python just to provide a base, and then try to convert the python into node-red nodes.  
Most of the opensource nodes seem to be tackling very specific problems so I would have to go through the process of step by step analysis.

Once again, greatly appreciate your responses.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [16 April 2024 11:25 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/6 "2024-04-16T11:25:48Z")

</div>

> [@New\_to\_node\_red](#):
>
> then try to convert the python into node-red nodes.

An option is to keep the code in python in a separate process and use MQTT to transfer data to and from node-red.

---

<div class="post-metadata">

### Author: ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)
#### Post date: [16 April 2024 15:07 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/7 "2024-04-16T15:07:38Z")

</div>

I think I remember I have posted several examples of Python scripts with MQTT support added here in this forum, question is where I now can find them 😉

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [16 April 2024 18:09 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/8 "2024-04-16T18:09:21Z")

</div>

> [@krambriw](#):
>
> question is where I now can find them

I'd say one of these 12 is a good bet: [Search results for '@krambriw paho.mqtt.client order:latest' - Node-RED Forum](https://discourse.nodered.org/search?context=topic&context_id=86990&q=%40krambriw%20paho.mqtt.client%20order%3Alatest&skip_context=true)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [30 April 2024 18:09 UTC](https://discourse.nodered.org/t/pythonshell-exit-code-4508/86990/9 "2024-04-30T18:09:56Z")

</div>

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