-1
目前我想通過下面這個教程使我的覆盆子PI與亞馬遜的AWS物聯網2工作:https://www.hackster.io/phantom-formula-e97912/network-monitoring-with-aws-iot-b8b57c?ref=platform&ref_id=425_trending___&offset=12Python函數的帶寬門檻IndexError:列表索引超出範圍的錯誤
對於這個功能,這應該發出警告對於超出網絡帶寬門檻:
def monspeed():
c = checkspeed(-1)
if c[2] > 2000000: # customize the interface/speed to trigger the warning
awsmsg = {'state':{ 'reported': {'warning': 'speed' , 'result': c}}}
payload = json.dumps(awsmsg)
print (awsmsg)
client.publish(topic,payload,qos,retain)
我收到此錯誤信息:
Traceback (most recent call last):
File "./netmon.py", line 158, in <module>
monspeed()
File "./netmon.py", line 98, in monspeed
if c[2] > 2000000: # customize the interface/speed to trigger the warning
IndexError: list index out of range
歡迎來到本網站!請提供更多信息,以便人們可以更好地幫助您。在這種情況下,至少checkpeed()的內容是必需的。請參見[如何創建最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。 – glibdud