MC2221A import board RuntimeError: already open
See original GitHub issueHello,
When running following python code
import os; os.environ['BLINKA_MCP2221'] = '1'
import os; os.environ['BLINKA_MCP2221_RESET_DELAY'] = '0.5'
import board
I get following error:
Traceback (most recent call last): File “c:\Users\Nick\Desktop\mc2221a.py”, line 8, in <module> import board File “C:\Python39\lib\site-packages\board.py”, line 182, in <module> from adafruit_blinka.board.microchip_mcp2221 import * File “C:\Python39\lib\site-packages\adafruit_blinka\board\microchip_mcp2221.py”, line 5, in <module> from adafruit_blinka.microcontroller.mcp2221 import pin File “C:\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\pin.py”, line 5, in <module> from .mcp2221 import mcp2221 File “C:\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\mcp2221.py”, line 389, in <module> mcp2221 = MCP2221() File “C:\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\mcp2221.py”, line 58, in init self._reset() File “C:\Python39\lib\site-packages\adafruit_blinka\microcontroller\mcp2221\mcp2221.py”, line 128, in _reset self._hid.open(MCP2221.VID, MCP2221.PID) File “hid.pyx”, line 111, in hid.device.open RuntimeError: already open
If I just set environment variable and open a Python shell and just type “import board” I get same exact error as above.
If I try to use PyMCP2221A module to communicate with my MCP221A device instead, it seems to be working fine. “MCP2221 I2C/SMBus Terminal” utility also seems to be working fine (I can read data via I2C protocol)
I’m using latest version of adafruit-blinka (7.1.1) & hidapi (0.11.2). I was using following guide to set everything up: https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-mcp2221/windows My environment is Windows 11
Issue Analytics
- State:
- Created a year ago
- Comments:11 (7 by maintainers)
Top GitHub Comments
I can confirm upgrading from installed
adafruit-blinka-7.1.2
toadafruit-blinka-7.2.2
fixed the issue, after the upgrade settingBLINKA_MCP2221_RESET_DELAY
to-1
,0.5
or not setting any value at all works fine.Please try updating to the 7.2.2 release of Blinka: https://github.com/adafruit/Adafruit_Blinka/releases/tag/7.2.2