我试图定义一个简单的python路径,但我总是得到一个错误。有人能告诉我如何设置正确的路径吗?我正在做一个树莓派。
下面是不能工作的代码:
import re, os, rrdtool, time, sys
# define pathes to 1-wire sensor data
pathes = "/sys/bus/w1/devices/10-000801ddae93/w1_slave"
和
# insert data into round-robin-database
rrdtool.update(
"%s/temperature.rrd" % (os.path.dirname(os.path.abspath(__file__))),
data)
我得到的错误:
07/27/15 13:21:37 Error reading s : [Errno 2] No such file or directory: 's'
07/27/15 13:21:39 Error reading y : [Errno 2] No such file or directory: 'y'
07/27/15 13:21:40 Error reading s : [Errno 2] No such file or directory: 's'
07/27/15 13:21:41 Error reading / : [Errno 21] Is a directory: '/'
07/27/15 13:21:42 Error reading b : [Errno 2] No such file or directory: 'b'
07/27/15 13:21:44 Error reading u : [Errno 2] No such file or directory: 'u'
07/27/15 13:21:45 Error reading s : [Errno 2] No such file or directory: 's'
07/27/15 13:21:46 Error reading / : [Errno 21] Is a directory: '/'
07/27/15 13:21:48 Error reading w : [Errno 2] No such file or directory: 'w'
07/27/15 13:21:49 Error reading 1 : [Errno 2] No such file or directory: '1
'等等…
和
Traceback (most recent call last):
File "/home/pi/python.py", line 39, in <module>
data)
error: /home/pi/temperature.rrd: found extra data on update argument: U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U:U
我希望你能帮助我。
update()可能需要一个列表类型,或者可以迭代的类型。
试…更新([…)