I did change the path to python with /usr/bin/python which is the output of which python
. Started the file with systemctl start athsense_startup
and then typed journalctl -fu athsense_startup
(athsense_startup.service is the actual name of the file) and the output is this:
-- Logs begin at Thu 2016-11-03 17:16:42 UTC. --
Dec 27 14:51:37 bela python[808]: Try `python -h' for more information.
Dec 27 14:51:37 bela systemd[1]: athsense_startup.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 27 14:51:37 bela systemd[1]: athsense_startup.service: Unit entered failed state.
Dec 27 14:51:37 bela systemd[1]: athsense_startup.service: Failed with result 'exit-code'.
Dec 27 14:51:38 bela systemd[1]: athsense_startup.service: Service hold-off time over, scheduling restart.
Dec 27 14:51:38 bela systemd[1]: Stopped Run Athses Python script on boot.
Dec 27 14:51:38 bela systemd[1]: athsense_startup.service: Start request repeated too quickly.
Dec 27 14:51:38 bela systemd[1]: Failed to start Run Athses Python script on boot.
Dec 27 14:51:38 bela systemd[1]: athsense_startup.service: Unit entered failed state.
Dec 27 14:51:38 bela systemd[1]: athsense_startup.service: Failed with result 'exit-code'.
This is the Python script that I'm trying launch (in case it gives any hint):
import json
import urllib
import OSC, threading
send_addr = "127.0.0.1", 9001
recv_addr = "127.0.01", 9010
c = OSC.OSCClient()
c.connect(send_addr)
msg = OSC.OSCMessage()
msg.setAddress("/data")
# append two values to msg, one for the secondary OSC address and one for the value
msg.append(0)
msg.append(0)
s = OSC.OSCServer(recv_addr)
url = "http://codemix.gr/athsense/getdata.php"
def float_str(num):
try:
float(num)
return float(num)
except ValueError:
return False
def make_http_req(add, tag, data, source):
url_data = urllib.urlopen(url)
url_str = url_data.read()
info = json.loads(url_str)
num_dict = {}
for num in info:
num_dict[num] = info[num]
for key in num_dict.keys():
if num_dict[key].isdigit():
num_dict[key] = int(num_dict[key])
else:
val = float_str(num_dict[key])
if val is not False:
num_dict[key] = val
for key in num_dict.keys():
msg[0] = key
msg[1] = num_dict[key]
c.send(msg)
s.addMsgHandler("/make_req", make_http_req)
st = threading.Thread(target=s.serve_forever)
st.start()