运行 脚本时获取 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,您会得到任何结果吗?如果它没有显示这样的文件或目录,那么你没有正确创建文件。