File "/usr/local/lib/python3.4/concurrent/futures/thread.py", line 54, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.4/site-packages/homeassistant/core.py", line 1030, in execute_service
service_handler.func(service_call)
File "/usr/local/lib/python3.4/site-packages/homeassistant/components/shell_command.py", line 70, in service_handler
stderr=subprocess.DEVNULL)
File "/usr/local/lib/python3.4/subprocess.py", line 537, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/lib/python3.4/subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "/usr/local/lib/python3.4/subprocess.py", line 1456, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/.homeassistant/mqtt_send_file.py'
A Python script is not directly executable unless you have an interpreter specified on the first line of the script. It will look something like
#!/usr/bin/python
in the file. Does that file exist? You should try running that “script” file from the command line shell while debugging this to ensure it works…
Alternatively, maybe your command invocation should just call python on the script file to avoid some of these problems, especially if you rely on the process’ PATH variable to find the python instance running in a virtualenv.
It says #!/usr/bin/python3.5 but I´m actually running 3.4 on my rPi
Tried to change to 3.4 and even #!/usr/bin/python but without luck
When I run the python from shell I get
pi@Telldus ~/.homeassistant $ python mqtt_send_file.py
Traceback (most recent call last):
File “mqtt_send_file.py”, line 3, in
import paho.mqtt.client as mqtt
ImportError: No module named paho.mqtt.client
but I have it installed:
Requirement already satisfied: paho-mqtt in /usr/local/lib/python3.4/site-packages
I am not familiar with the various Raspberry Pi installations of home assistant, as I run it on a Mac mini installed in a virtualenv. Its possible that your Home Assistant installation is running in a virtual environment and has different runtime environment than the default installation.
Is there a file ~/.homeassistant/bin/activate present? If source, from the shell you should do
source ~/.homeassistant/bin/activate
and you will now have the same environment that Home Assistant is using while its running, and when it spawns processes. Maybe that environment doesn’t have MQTT present (though that seems unlikely). But it might be useful to check.