# Exec command can be used to Stop executing python code using "Python Shell" Node

**URL:** <https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265>\
**Category:** Developing Nodes\
**Created:** [3 November 2020 08:40 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265 "2020-11-03T08:40:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheebha](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@sheebha](https://discourse.nodered.org/u/sheebha)\
**Post date:** [3 November 2020 08:40 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265/1 "2020-11-03T08:40:42Z")

</div>

Hi All,  
I have executed a python script (taken locally) using a python shell node in node-red. What is the command can be used in exec to stop running infinity loop??  
Can anyone help me??

---

<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:** [3 November 2020 08:43 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265/2 "2020-11-03T08:43:46Z")

</div>

Hi, are you the same user as Sandy?

This thread is ALMOST identical to one less than a page down in the forum...

> [@Stop executing the python code using "Python Shell" Node](https://discourse.nodered.org/t/stop-executing-the-python-code-using-python-shell-node/35194):
>
> Hi All, I executed a python script(taken locally) using a python shell node in node-red. But As I am running Infinite Loop code I was unable to stop the execution. Please Help me out..?

---

<div class="post-metadata">

**Author:** ![sheebha](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@sheebha](https://discourse.nodered.org/u/sheebha)\
**Post date:** [3 November 2020 08:46 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265/3 "2020-11-03T08:46:04Z")

</div>

yes, I am also facing the same issue and I have tried using Kill-2, Kill-9. I am getting an error in Exec can you help me which command can be used?? can you please help me??

 ![Capture](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b7fef4a91a21779b465f7a2be8e34ae316d0ca49.png)

---

<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:** [3 November 2020 09:22 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265/4 "2020-11-03T09:22:46Z")

</div>

You can't use the exec node to kill the pythonshell node, you have to use the exec node to run the python script, instead of using the pythonshell node. Then when it is running you can kill the exec node if necessary.  
Is this a college assignment or similar since you both seem to be working on similar projects?

---

<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:** [2 January 2021 09:22 UTC](https://discourse.nodered.org/t/exec-command-can-be-used-to-stop-executing-python-code-using-python-shell-node/35265/5 "2021-01-02T09:22:55Z")

</div>

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