blacklight / platypush

A versatile and extensible platform for automation with hundreds of supported integrations
https://platypush.tech
MIT License
284 stars 20 forks source link

Systemd service not working #164

Closed Coday-meric closed 3 years ago

Coday-meric commented 3 years ago

Hello

I am trying to allow platypush to start automatically using systemd. Except that with the configuration provided by default. Systemd cannot find the file. I tried using this command also /usr/bin/python3 /usr/bin/platypush, the file and although finding platypush seems to start but it returns a module error.

janv. 22 19:29:17 raspberrypi python3[1659]: 2021-01-22 19:29:17,993| INFO|platypush|---- Starting platypush v.0.13.9 janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,790|WARNING|platypush|Traceback (most recent call last): janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,791|WARNING|platypush| File "/home/pi/platypush/bin/platypush", line 6, in <module> janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,791|WARNING|platypush|main() janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,791|WARNING|platypush| File "/usr/local/lib/python3.7/dist-packages/platypush/__init__.py", line 199, in main janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,792|WARNING|platypush|app.start() janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,792|WARNING|platypush| File "/usr/local/lib/python3.7/dist-packages/platypush/__init__.py", line 171, in start janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,792|WARNING|platypush|self.backends = register_backends(bus=self.bus, global_scope=True) janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,793|WARNING|platypush| File "/usr/local/lib/python3.7/dist-packages/platypush/context/__init__.py", line 53, in register_backends janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,793|WARNING|platypush|b = getattr(module, cls_name)(bus=bus, **cfg, **kwargs) janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,793|WARNING|platypush| File "/usr/local/lib/python3.7/dist-packages/platypush/backend/zwave/__init__.py", line 105, in __init__ janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,794|WARNING|platypush|import python_openzwave janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,794|WARNING|platypush|ModuleNotFoundError janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,794|WARNING|platypush|: janv. 22 19:29:18 raspberrypi python3[1659]: 2021-01-22 19:29:18,794|WARNING|platypush|No module named 'python_openzwave' janv. 22 19:29:18 raspberrypi systemd[1]: platypush.service: Main process exited, code=exited, status=1/FAILURE janv. 22 19:29:18 raspberrypi systemd[1]: platypush.service: Failed with result 'exit-code'.

I specify that the platypush command in the terminal works perfectly.

Thanks You

blacklight commented 3 years ago

On which OS are you testing it? The setup.py script installs the files under the default OS prefix. That is /usr under most of the distributions but may be /usr/local under others.

To check where the main script is installed:

which platypush

Then you can either modify the systemd service to run that file or install Platypush under /usr through [sudo] python3 setup.py build install --prefix=/usr.

Coday-meric commented 3 years ago

Thanks for your quick response, I'm using on raspbian, it looks like platypush is installed in my user /home/pi/.local/bin/platypush folder is this normal?

blacklight commented 3 years ago

You probably ran setup.py as the pi user or with the --user prefix. Try running with sudo and --prefix=/usr to install it under /usr.

Coday-meric commented 3 years ago

Perfect ! Tahnks for your help.