CH347-HIDAPI icon indicating copy to clipboard operation
CH347-HIDAPI copied to clipboard

AttributeError: 'CH347HIDDev' object has no attribute 'i2c_exists'

Open logan20240817 opened this issue 9 months ago • 2 comments

测试demo.py 程序报错 AttributeError: 'CH347HIDDev' object has no attribute 'i2c_exists'

logan20240817 avatar Apr 07 '25 04:04 logan20240817

运行pip install -U ch347api升级到最新版的库试试

i2cy avatar Apr 07 '25 05:04 i2cy

执行升级动作,重新安装 依然会报同样的错误。

logan20240817 avatar Apr 09 '25 07:04 logan20240817

The latest does not appear to have been pushed to the servers pip looks to. I see the same issue even after executing pip3 install -U ch347api:

$ pip3 install -U ch347api
Requirement already satisfied: ch347api in ./venv/lib/python3.13/site-packages (0.3.2)
Requirement already satisfied: hidapi in ./venv/lib/python3.13/site-packages (from ch347api) (0.14.0.post4)
Requirement already satisfied: setuptools>=19.0 in ./venv/lib/python3.13/site-packages (from hidapi->ch347api) (80.9.0)
$ pip3 show ch347api
Name: ch347api
Version: 0.3.2
Summary: A Python Library provides full access of SPI/I2C/UART settings and communication with CH347 USB-SPI/I2C/UART bridge chip in Python language.
Home-page: https://github.com/i2cy/ch347-hidapi
Author: I2cy Cloud
Author-email: [email protected]
License:
Location: /Users/.../i2ctest/venv/lib/python3.13/site-packages
Requires: hidapi
Required-by:
$ ./demo.py
[I2C] Scan start...
      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
0x00: Traceback (most recent call last):
  File "/Users/.../i2ctest/./demo.py", line 143, in <module>
    i2c_demo()
    ~~~~~~~~^^
  File "/Users/.../i2ctest/./demo.py", line 22, in i2c_demo
    exists = hiddev.i2c_exists(i)
             ^^^^^^^^^^^^^^^^^
AttributeError: 'CH347HIDDev' object has no attribute 'i2c_exists'

I fixed this by removing the pip package, cloning the repo and running python3 setup.py install.

akohlsmith avatar Aug 20 '25 17:08 akohlsmith