我用python3寫了一個程式,將PCF8591的溫度和另一個太陽能板的電壓還有一個樹莓派CPU的溫度,每隔5秒上傳到onenet,同時列印一些資料到視窗,初期運行比較正常,一直出差,但是幾天后程式忽然就中斷了,資料不上傳了。到了辦公室發現程式有個提示:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thonny/workbench.py", line 1432, in event_generate
handler(event)
File "/usr/lib/python3/dist-packages/thonny/assistance.py", line 135, in handle_toplevel_response
self._explain_exception(msg["user_exception"])
File "/usr/lib/python3/dist-packages/thonny/assistance.py", line 163, in _explain_exception
error_info["filename"]
File "/usr/lib/python3.5/genericpath.py", line 19, in exists
os.stat(path)
TypeError: stat: can't specify None for path argument
E文不好,也沒搞懂具體怎么回事,有大神指點一下么?
uj5u.com熱心網友回復:
肯定是你的程式在什么特殊情況下給輸入了一個空的路徑。我做Java初期也經常這樣。如果不想深究就加個檔案路徑是否為空的判斷就行了。轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/268786.html
標籤:其他技術討論專區
上一篇:抖音協議成品資源
