Just realised I didnt have the bin/bash whatever at the start of the file but now struggling to get that right.
I tried the shebang you mention and various others but non work, I tried
echo $PYTHONPATH
but returned nothing which is probably why??
I have only been calling the scripts with python and used that in openhab too in the exec commands and it did work fine.
the script is here
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import time
#set up channel ref here!!
channel=0
INDEX=int(channel)
SPI_PORT=0
SPI_DEVICE=0
mcp=Adafruit_MCP3008.MCP3008(spi=SPI.SpiDev(SPI_PORT,SPI_DEVICE))
calibration=-2
table=[-20,96974,
-15,72895,
-10,55298,
-5,42314,
0,32650,
1,31030,
2,29500,
3,28054,
4,26688,
5,25396,
6,24173,
7,23016,
8,21921,
9,20885,
10,19904,
11,18974,
12,18092,
13,17257,
14,16465,
15,15714,
16,15001,
17,14325,
18,13623,
19,13053,
20,12494,
21,11943,
22,11420,
23,10923,
24,10450,
25,10000,
26,9572,
27,9165,
28,8777,
29,8408,
30,8056,
35,6530,
40,5325,
45,4367,
50,3601,
55,2985,
60,2487,
65,2082,
70,1751,
75,1480,
80,1256,
85,1070
]
def getRes():
adc0=mcp.read_adc(INDEX)
if adc0>=1023 or adc0<=1:
return 1024
vin=3.319
balance=9860
vout=(adc0*vin)/1024
res=int((balance*vout)/(vin-vout))
return res
resx=getRes()
resy=getRes()
resz=getRes()
res0=(resx+resy+resz)/3
for i in xrange(0,len(table)-2,2):
if res0<=table[i+1] and res0>=table[i+3]:
r1=float(table[i+1])
r2=float(table[i+3])
t1=float(table[i])
t2=float(table[i+2])
res=float(res0)
temp=round(t1+(((t2-t1)*(res-r1))/(r2-r1)),2)+calibration
print(temp)
#print(str(temp))