簡體   English   中英

Python路徑定義/ Python 2.7.3

[英]Python path define / Python 2.7.3

我試圖定義一個簡單的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

我希望你能幫助我。

update()可能需要一個列表類型,或者你可以迭代的東西。

試試......更新([....])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM