adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
453 stars 340 forks source link

Adafruit-PlatformDetect version 3.69.0 was unable to identify the board #851

Closed LPonGit closed 3 months ago

LPonGit commented 3 months ago

I am Trying to use a MCP2221A with a htk16K33 7 Segment Display from a MAC book using Python.

Python 3.12.4

Adafruit-Blinka 8.43.0 adafruit-circuitpython-busdevice 5.2.9 adafruit-circuitpython-connectionmanager 3.1.0 adafruit-circuitpython-ht16k33 4.6.9 adafruit-circuitpython-requests 4.0.0 adafruit-circuitpython-typing 1.10.3 Adafruit-PlatformDetect 3.69.0 Adafruit-PureIO 1.1.11 certifi 2024.6.2 coverage 7.5.3 hidapi 0.14.0 iniconfig 2.0.0 mcp2221 1.1.0 packaging 24.1 pip 24.0 pluggy 1.5.0 pyftdi 0.55.4 pyserial 3.5 pytest 8.2.2 pytest-cov 5.0.0 pyusb 1.2.1 setuptools 70.0.0 typing_extensions 4.12.

Launching the countup.py script from PythonLauncher (attached in txt format) countup.txt gives the following error:

Last login: Sat Jun 15 21:11:47 on ttys000 cd '/Users/lee/Documents/My Scripts/' && '/usr/local/bin/python3' '/Users/lee/Documents/My Scripts/countup.py' && echo Exit status: $? && exit 1 BEP@CAM ~ % cd '/Users/lee/Documents/My Scripts/' && '/usr/local/bin/python3' '/Users/lee/Documents/My Scripts/countup.py' && echo Exit status: $? && exit 1 Traceback (most recent call last): File "/Users/lee/Documents/My Scripts/countup.py", line 5, in import board File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/board.py", line 425, in raise NotImplementedError( NotImplementedError: Adafruit-PlatformDetect version 3.69.0 was unable to identify the board and/or microcontroller running the Darwin platform. Please be sure you have the latest packages by running: 'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

    If you are running the latest package, your board may not yet be supported. Please
    open a New Issue on GitHub at https://github.com/adafruit/Adafruit_Blinka/issues and
    select New Board Request.
    **********************************************************************************************

Any guidance really appreciated Thank you Lee

LPonGit commented 3 months ago

I have been looking at this for a while now. import board executes fine from the command line REPL enviroment I believe the issue is setting the Environment Variable "export BLINKA_MCP2221="1"" when running a python script file launched from Python Launcher

Thoughts / confirmation ?? Solved !! it is setting of the Environment Variable "export BLINKA_MCP2221="1"" within the PY scripts that was missing.

LPonGit commented 3 months ago

Solved by setting the Environment Variable "export BLINKA_MCP2221="1"" within the PY script before the import board command.

import os
os.environ["BLINKA_MCP2221"] = "1"