[英]Getting OSError when running script
I am trying to set up the ChirpSDK, but every time I configure and run the code, I get this error:我正在尝试设置 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'
I realize that the error is saying that my .chirprc file is not being recognized, but I have no idea how to remedy this.我意识到错误是说我的 .chirprc 文件没有被识别,但我不知道如何解决这个问题。 I created a .chirprc file in my /Users/username/ path, and named it c.chirprc (as the Chirp getting started article suggests), but I am still getting this error.我在 /Users/username/ 路径中创建了一个 .chirprc 文件,并将其命名为 c.chirprc(正如 Chirp 入门文章所建议的那样),但我仍然收到此错误。 Is there another part that I am missing?我还缺少其他部分吗? Am I reading the instructions wrong?我读错了说明吗?
Thanks谢谢
The Chirp configuration file should be placed at /Users/<username>/.chirprc
on macOS. Chirp 配置文件应放置在 macOS 上的/Users/<username>/.chirprc
。
If you run ls -l ~/.chirprc
in the terminal, do you get any results?如果你在终端中运行ls -l ~/.chirprc
,你有什么结果吗? If it displays no such file or directory then you have not created the file correctly.如果它没有显示这样的文件或目录,则说明您没有正确创建该文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.