我正在尝试定义一个简单的python路径,但我总是遇到错误。 有人可以告诉我如何设置正确的路径。 我正在研究Raspberry Pi。
以下代码不起作用:
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
我希望你能帮助我。
答案 0 :(得分:0)
update()可能需要一个列表类型,或者你可以迭代的东西。
尝试 ...更新([....])