簡體   English   中英

運行腳本時出現 OSError

[英]Getting OSError when running script

我正在嘗試設置 ChirpSDK,但每次配置和運行代碼時,都會收到此錯誤:

  Traceback (most recent call last):
  File "test.py", line 3, in <module>
    chirp = ChirpSDK()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 395, in __init__
    self.read_chirprc(block)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 501, in read_chirprc
    raise IOError('Could not find a ~/.chirprc file')
OSError: Could not find a ~/.chirprc file
Exception ignored in: <function ChirpSDK.__del__ at 0x10fa31af0>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 422, in __del__
    self.close()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/chirpsdk/chirpsdk.py", line 470, in close
    if self._sdk:
AttributeError: 'ChirpSDK' object has no attribute '_sdk'

我意識到錯誤是說我的 .chirprc 文件沒有被識別,但我不知道如何解決這個問題。 我在 /Users/username/ 路徑中創建了一個 .chirprc 文件,並將其命名為 c.chirprc(正如 Chirp 入門文章所建議的那樣),但我仍然收到此錯誤。 我還缺少其他部分嗎? 我讀錯了說明嗎?

謝謝

Chirp 配置文件應放置在 macOS 上的/Users/<username>/.chirprc

如果你在終端中運行ls -l ~/.chirprc ,你有什么結果嗎? 如果它沒有顯示這樣的文件或目錄,則說明您沒有正確創建該文件。

暫無
暫無

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

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