简体   繁体   English

运行脚本时出现 OSError

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

相关问题 Python运行bash脚本并生成OSError - Python running bash script and generate OSError 运行此脚本时为什么会出现“ OSError:[Errno 2] No such file or directory”的错误? - Why do I get “OSError: [Errno 2] No such file or directory” when running this script? 获取OSError:在使用多处理的代码上运行冗长的测试套件时,打开的文件太多 - getting OSError: too many open files when running longish test suite on code that uses multiprocessing OSError:[Errno 13]运行CGIHTTPServer时 - OSError: [Errno 13] when running CGIHTTPServer 使用MoviePy时遇到OSError - Running into OSError when I use MoviePy 在树莓派上运行puppeteer时出现OSError - OSError when running puppeteer on raspberry pi 尝试 pip 安装时出现 OSError - getting an OSError when trying to pip install 为什么在运行此脚本时获取无效的文字? - Why getting invalid literal when running this script? 运行 web 抓取脚本时获取不可下标 - Getting a not subscriptable when running a web scraping script 在终端中运行 python 脚本时出错:OSError: [Errno 2] No such file or directory - Error running python script in terminal: OSError: [Errno 2] No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM