1

I want to run a code at startup but I am getting this error below. The script works when running in python, but I am unsure how to allocate permissions or where to make a path to the pxcore.so file so this startup service will work. If anyone can help, I would greatly appreciate it.

sudo systemctl status autodetect.service
● autodetect.service - Auto Detect Service
Loaded: loaded (/lib/systemd/system/autodetect.service; enabled)
Active: failed (Result: signal) since Tue 2017-06-13 20:21:21 CDT; 10s ago
Process: 1145 ExecStart=/usr/bin/python /home/pi/pixetrpi/autodetect.py  (code=killed, signal=SEGV)
Main PID: 1145 (code=killed, signal=SEGV)

Jun 13 20:21:21 raspberrypi systemd[1]: Started Auto Detect Service.
Jun 13 20:21:21 raspberrypi python[1145]: Cannot load library  "./pxcore.so": ./pxcore.so: cannot open shared object file: No such fi...rectory
Jun 13 20:21:21 raspberrypi systemd[1]: autodetect.service: main process exited, code=killed, status=11/SEGV
Jun 13 20:21:21 raspberrypi systemd[1]: Unit autodetect.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

The service I have created is:

[Unit]
Description= Auto Detect Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/usr/bin/python /home/pi/pixetrpi/autodetect.py
WorkingDirecory=/home/pi

[Install]
WantedBy=multi-user.target

Which runs this autodetect.py script I created:

import pypixet

from time import sleep

import acquisition_example

def autodetect(pixet):
devices = pixet.devices()

while str(type(devices[0])) != "<type 'IDevMpx2'>":
    print(devices)
    sleep(1)
    devices = pixet.devices()
return pixet.devices().pop()

if __name__ == "__main__":
device = autodetect(acquisition_example.pixet)
print("Discovered minipix!")
acquisition_example.acqExample1()
0

I think your issue could be that you have multiple versions of python (just talking by experience, might be wrong).

I had similar issues in the past with python/systemctl, you should try to include something like #!/usr/bin/python. This way you tell the service running the script, which interpreter to use and where to find it. This question talks a little about shebang lines, if you want more info on this:

https://stackoverflow.com/questions/2429511/why-do-people-write-usr-bin-env-python-on-the-first-line-of-a-python-script

I'm not 100% sure this will fix it, but i think you should give it a try, since for example the version of python used by your systemctl service to run your script, may not have that library installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.