[SOLVED] Running a python script using the Exec binding


(Matthew Clegg) #1

Hi another query,

I’m trying to run a python script from the exec binding, it does seem to be running (it has stopped erroring in the logs) but i suspect the python is failing due to be unable to find a module

When I run the python with this

 sudo -u openhab python3.5 Nearest360.py

Traceback (most recent call last):
  File "Nearest360.py", line 4, in <module>
    import requests
ImportError: No module named 'requests'

This runs fine using the openhabian user from the command line.

Any ideas?


(Vincent Regaud) #2

You need some python help. Not openHAB
install the request library


(Matthew Clegg) #3

I have installed the library using pip on the openhabian user, this is specific to using the openhab user, I am investigating python forums also but suspected someone over here may have come across a similar error and solved it.


(Vincent Regaud) #4

(Matthew Clegg) #5

Thanks, that looks like it may have done the trick. The wonders of knowing what you are looking for


(Vincent Regaud) #6

Please tick the solution post, thanks


(Simon#56) #7

I have the same error but I’m unable to fix it using the link provided above. What exaclty did you do to fix the issue?


(Michael) #8

Please see my answer to your question in the thread about the bmw connected python script.
You installed the request module for Python 2.7 instead of Python 3.
The bmw python script uses Python 3 and you need to install the request module with pip3.