Hi All!
I am a bit afraid of asking a question which has been answered before, but I can't find anything like my question on this forum.
I keep getting a very strange error message in the python part, when I start the script without webiopi, it just works.
What am I doing wrong?
Thank you very much!
Overhere is my setup:
/etc/webiopi/config
**********************************************************************************************************************************
[SCRIPTS]
DAC = /home/pi/terrariumController/fan/python/fan.py
#------------------------------------------------------------------------#
[HTTP]
# HTTP Server configuration
# Use doc-root to change default HTML and resource files location
doc-root = /home/pi/terrariumController/fan/html
**********************************************************************************************************************************
fan.py
**********************************************************************************************************************************
#!/usr/bin/python
from Adafruit_MCP4725 import MCP4725
import time
import webiopi
import sys
sys.path.append("/home/pi/terrariumController/fan/html")
sys.path.append("/home/pi/terrariumController/fan/python")
sys.path.append("/home/pi/mcp4725/Adafruit-Raspberry-Pi-Python-Code/Adafruit_MCP4725")
sys.path.append("/home/pi/mcp4725/Adafruit-Raspberry-Pi-Python-Code/Adafruit_I2C")
@webiopi.macro
def setDAC(value):
dac.setVoltage(value)
return
# Initialise the DAC using the default address
dac = MCP4725(0x62)
dac.setVoltage(0)
setDAC(00)
**********************************************************************************************************************************
And this is the error message which I get:
**********************************************************************************************************************************
pi@raspberrypi ~/terrariumController/fan/python $ webiopi -d -c /etc/webiopi/config
2015-02-26 20:26:40 - WebIOPi - INFO - Starting WebIOPi/0.7.0/Python3.2
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.digitalCount to REST GET /GPIO/count
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.digitalRead to REST GET /GPIO/%(channel)d/value
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.digitalWrite to REST POST /GPIO/%(channel)d/value/%(value)d
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.getFunctionString to REST GET /GPIO/%(channel)d/function
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.getPulse to REST GET /GPIO/%(channel)d/pulse
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.outputSequence to REST POST /GPIO/%(channel)d/sequence/%(args)s
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.portRead to REST GET /GPIO/*/integer
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.portWrite to REST POST /GPIO/*/integer/%(value)d
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.pulse to REST POST /GPIO/%(channel)d/pulse/
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.pulseAngle to REST POST /GPIO/%(channel)d/pulseAngle/%(value)f
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.pulseRatio to REST POST /GPIO/%(channel)d/pulseRatio/%(value)f
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.setFunctionString to REST POST /GPIO/%(channel)d/function/%(value)s
2015-02-26 20:26:40 - WebIOPi - DEBUG - Mapping GPIO.wildcard to REST GET /GPIO/*
2015-02-26 20:26:40 - WebIOPi - INFO - GPIO - Native mapped to REST API /GPIO
2015-02-26 20:26:40 - WebIOPi - INFO - Loading configuration from /etc/webiopi/config
2015-02-26 20:26:40 - WebIOPi - INFO - Loading DAC from /home/pi/terrariumController/fan/python/fan.py
2015-02-26 20:26:40 - WebIOPi - ERROR - invalid syntax (Adafruit_MCP4725.py, line 29)
Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv6l.egg/webiopi/__main__.py", line 75, in <module>
main(sys.argv)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv6l.egg/webiopi/__main__.py", line 69, in main
server = Server(port=port, configfile=configfile, scriptfile=scriptfile)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv6l.egg/webiopi/server/__init__.py", line 75, in __init__
loader.loadScript(name, source, self.restHandler)
File "/usr/local/lib/python3.2/dist-packages/WebIOPi-0.7.0-py3.2-linux-armv6l.egg/webiopi/utils/loader.py", line 8, in loadScript
script = imp.load_source(name, source)
File "/home/pi/terrariumController/fan/python/fan.py", line 3, in <module>
from Adafruit_MCP4725 import MCP4725
File "Adafruit_MCP4725.py", line 29
print "Setting voltage to %04d" % voltage
^
SyntaxError: invalid syntax