Metro M0 Express Library not Importing

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
violaEmperor
 
Posts: 6
Joined: Wed Aug 18, 2021 4:44 pm

Metro M0 Express Library not Importing

Post by violaEmperor »

Hello,
I tried to run this circuitpython program today on my Metro M0 Express, I got the error message:

code.py output:
Traceback (most recent call last):
File "code.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'time'

This is the test program I had uploaded.

Code: Select all

import time
while True:
    print(time.time())
When I enter the REPL in mu though, it says Adafruit CircuitPython 2.2.0 on 2018-01-02; Adafruit Metro M0 Express with samd21g18. I tried to upload the Circuitpython 6.3.0 from the CircuitPython website, but I got the same results. I am on MacOS 10.15.7.

Thank you

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

Re: Metro M0 Express Library not Importing

Post by dastels »

Weird.

It's importing fine (it would explicitly say it couldn't import it)... it just doesn't see the time() method.

Try deleting and retyping (not copy/paste). Sometimes there are non-printing characters that get picked up.

Alternatively, what happens if you *type* this into the REPL?

Code: Select all

import time
time.time()
Dave

User avatar
violaEmperor
 
Posts: 6
Joined: Wed Aug 18, 2021 4:44 pm

Re: Metro M0 Express Library not Importing

Post by violaEmperor »

When I try it in the Repl, I get the error message
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'time'

Is it a problem with the version? Since the Repl says it's version 2.2.0, and I downloaded the 6.x.x libraries and I'm using the stable 6.3.0 release, could it be that there is some issue where the library versions don't line up? The circuitpython download said that time was a built in module.

Thanks

User avatar
violaEmperor
 
Posts: 6
Joined: Wed Aug 18, 2021 4:44 pm

Re: Metro M0 Express Library not Importing

Post by violaEmperor »

For some reason, when it works when I use the sleep method of time.

from time import sleep
while True:
sleep(1)
print("yes")
Is there something wrong with the circuitpython .uf2 file I downloaded?
Thanks

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

Return to “Metro, Metro Express, and Grand Central Boards”