MS8607: cannot import name 'const' from 'micropython'

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
unwttng
 
Posts: 5
Joined: Wed May 05, 2021 11:27 am

MS8607: cannot import name 'const' from 'micropython'

Post by unwttng »

Hi there,

I'm trying to get set up with the MS8607 sensor on a Raspberry Pi Zero W. I've followed this guide https://learn.adafruit.com/circuitpytho ... spberry-pi to get it set up with CircuitPython / Blinka and then run

Code: Select all

sudo pip3 install adafruit-circuitpython-ms8607
as per this guide: https://learn.adafruit.com/adafruit-te- ... cuitpython.

However, when I try importing the adafruit_ms8607 module in python3 I get the following error:

Code:

Code: Select all

import board
import busio
from adafruit_ms8607 import MS8607
Error:

Code: Select all

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/dist-packages/adafruit_ms8607.py", line 38, in <module>
    from micropython import const
ImportError: cannot import name 'const' from 'micropython' (/usr/local/lib/python3.9/dist-packages/micropython.py)
I've double-checked that I didn't miss any of the setup steps, I2C and SPI devices are available on the Pi. Not sure where else I might have gone wrong?

Thanks for any help!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: MS8607: cannot import name 'const' from 'micropython'

Post by dastels »

It looks like const can't be found in /usr/local/lib/python3.9/dist-packages/micropython.py. You can have a look in it to verify whether of not it's there.

Is micropython.py up to date?

Dave

User avatar
unwttng
 
Posts: 5
Joined: Wed May 05, 2021 11:27 am

Re: MS8607: cannot import name 'const' from 'micropython'

Post by unwttng »

I'm glad I looked! micropython.py seems to be totally empty, though the file itself does exist. I'm now trying to work out which part of the Adafruit guides I linked was supposed to perform the installation of micropython since it seems to have failed.

User avatar
unwttng
 
Posts: 5
Joined: Wed May 05, 2021 11:27 am

Re: MS8607: cannot import name 'const' from 'micropython'

Post by unwttng »

I'm going to have to assume that somewhere along the way that file got corrupted: I since tried totally re-imaging the Pi Zero W and running through the same steps and this time I ended up with a valid micropython.py file and a working sensor interface. Thanks for the help!

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: MS8607: cannot import name 'const' from 'micropython'

Post by dastels »

Weird.

Glad it's working for you!

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”