ModuleNotFoundError: No module named 'pyb'

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
spoetnic
Posts: 6
Joined: Sun Dec 08, 2019 12:08 pm

ModuleNotFoundError: No module named 'pyb'

Post by spoetnic » Tue Feb 11, 2020 2:19 pm

Hello, I'm just new to micropython and I just managed to get python installed on microsoft code.
Now I've connected my pyboard 1.1 and try to run a default program.
The first error I hit is: ModuleNotFoundError: No module named 'pyb'

I hope someone can help solving this? Thanks.

User avatar
dhylands
Posts: 3268
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: ModuleNotFoundError: No module named 'pyb'

Post by dhylands » Tue Feb 11, 2020 5:45 pm

Which board are you using? The pyb module exists on the stm32 port, and doesn't exist on the ESP32 and ESP8266 ports.

The general preference is to use the machine module where possible.

spoetnic
Posts: 6
Joined: Sun Dec 08, 2019 12:08 pm

Re: ModuleNotFoundError: No module named 'pyb'

Post by spoetnic » Thu Feb 13, 2020 8:45 am

Hi, I'm using the pyboard 1.1. So this is with the STM32405RG. I'm trying to upload an code to the board from VSCODE. The board is connected, but when trying to RUN it says:

PS C:\Users\Marc Frim> & "C:/Users/Marc Frim/AppData/Local/Programs/Python/Python38-32/python.exe" "c:/Users/Marc Frim/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.7/microExamples/examples/03.board/5.pyboard/blink.py"
Traceback (most recent call last):
File "c:/Users/Marc Frim/.vscode/extensions/rt-thread.rt-thread-micropython-1.0.7/microExamples/examples/03.board/5.pyboard/blink.py", line 2, in <module>
import pyb
ModuleNotFoundError: No module named 'pyb'
PS C:\Users\Marc Frim>

User avatar
jimmo
Posts: 1139
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: ModuleNotFoundError: No module named 'pyb'

Post by jimmo » Thu Feb 13, 2020 12:23 pm

It looks like it's trying to run in regular Python (i.e. CPython) rather than on the pyboard.

Post Reply