运行example.py时出现IO错误和属性错误

时间:2019-07-27 14:30:13

标签: chirp

我收到IO错误,因为找不到〜/ .chirprc文件。整个chirp sdk可从官方https://developers.chirp.io/downloads下载。

还有一个属性错误,它似乎被忽略了

  1. 运行以下命令:

    python setup.py install
    python setup.py build
    python example.py
    
  2. 确切的错误是:

    python example.py
    Traceback (most recent call last):
      File "example.py", line 102, in <module>
        main(args.c, args.i, args.o, args.b, args.s)
      File "example.py", line 56, in main
        sdk = ChirpConnect(block=block_name)
      File "C:\00_Work\01_Documents\09_Papers\05_Chirp\chirpsdk\connect.py", 
    line 392, in __init__
        self.read_chirprc(block)
      File "C:\00_Work\01_Documents\09_Papers\05_Chirp\chirpsdk\connect.py", 
    line 485, in read_chirprc
        raise IOError('Could not find a ~/.chirprc file')
    IOError: Could not find a ~/.chirprc file
    Exception AttributeError: "'ChirpConnect' object has no attribute '_sdk'" 
    in <bound method ChirpConnect.__del__ of <chirpsdk.connect.ChirpConnect 
    object at 0x0000000006CE4278>> ignored
    

1 个答案:

答案 0 :(得分:1)

对于登陆此页面的其他用户,可以在https://developers.chirp.io/docs/getting-started/python上找到Python SDK的文档。

~/.chirprc文件在Windows上对我有用。您必须确保将其保存在Python输出的该路径所在的位置。

import os
os.path.expanduser('~/.chirprc')