[英]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.