# Node-red contrib pythonshell

**URL:** <https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809>\
**Category:** General\
**Created:** [8 January 2021 20:08 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809 "2021-01-08T20:08:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miliano](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Miliano](https://discourse.nodered.org/u/Miliano)\
**Post date:** [8 January 2021 20:08 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/1 "2021-01-08T20:08:29Z")

</div>

Hello everybody 🙂

Please, I need your help!  
I want to start a python3 script from a node.  
For this I installed "node-red-contrib-pythonshell", works well with an easy script, but now i want to import "requests" modul and I always get this error:

> > exit code: 1, Traceback (most recent call last):  
> > File "kodi-pause.py", line 3, in   
> > import requests  
> > ModuleNotFoundError: No module named 'requests'

And I really have no idea why?  
I have created a virtual environment in the data directory of node-red and installed "request" in it. If I change to the environment from the console and start the script, its working fin, but not from the node.

I have no more ideas what to do and so every tip is welcome!  
Thanks in front and have a nice weekend!  
Mili

---

<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:** [8 January 2021 22:02 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/2 "2021-01-08T22:02:15Z")

</div>

Hi and welcome to the forum.

Can I ask, what is your end goal? To control a Kodi device?

Have you tried the Kodi nodes?

If you are just trying to do http requests, there is the built in http request node.

---

<div class="post-metadata">

**Author:** ![Miliano](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Miliano](https://discourse.nodered.org/u/Miliano)\
**Post date:** [8 January 2021 23:56 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/3 "2021-01-08T23:56:42Z")

</div>

Yes, that is a part of what I want to do, but there are many more python scripts, that I have wrote and i want them integreted.  
Kodi nodes will only be a workaround.  
And I hate to program in Java and love Python! 😃

And overall I want to understut why it don´t work.

But thanks for your tips!

---

<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:** [9 January 2021 00:56 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/4 "2021-01-09T00:56:01Z")

</div>

> [@Miliano](#):
>
> And I hate to program in Java

Then you're in luck, node-red is JavaScript.

But seriously, why not put the efforts in, learn to do things in native way, I promise you will love it just as much.

---

<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:** [9 January 2021 06:49 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/5 "2021-01-09T06:49:56Z")

</div>

While learning more & more about Node-RED & javascript, you can use the excellent EXEC node to start & run & recycle your existing Python script without problems. I have done this myself since years now. If you in addition need to exchange data between your Python scripts and Node-RED you can easily use MQTT. After some time you may even migrate some of your Python scripts and replace them with functionality provided by Node-RED. At least this is how I started to learn, coming from a pure Python and C++ environment

---

<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:** [10 March 2021 06:50 UTC](https://discourse.nodered.org/t/node-red-contrib-pythonshell/38809/6 "2021-03-10T06:50:03Z")

</div>

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