No module named pyb

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Theo.D
Posts: 1
Joined: Wed Oct 31, 2018 3:11 pm

No module named pyb

Post by Theo.D » Wed Oct 31, 2018 3:36 pm

Hello everybody,

I just got a Pyboard V1.1 and I'm encountering a small problem... (I'm really a beginner...)
For information, I'm using a Mac and Pyzo 4.4.2 with Anaconda.

My problem is the following : I plug the Pyboard with a micro-USB/USB cable to my Mac, then the board shows up on my desktop. I open the folder (which looks like a storage device and is named PYBFLASH) and there are the main.py/boot.py/pybcdc.inf and README.txt files in it. I double-click on the main.py file and it opens itself in Pyzo. Then, whenever I try to write "import pyb" or "from pyb import ...", I get the following message "ModuleNotFoundError: No module named 'pyb' ". I also tried "upyb"/"machine" and "umachine" but none of them are working.

So I would like to know if there is any solution :)
Thank you for your answers
Theo.D

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

Re: No module named pyb

Post by dhylands » Wed Oct 31, 2018 4:38 pm

It sounds like you might be trying to run the files on your Mac rather than on the pyboard.

Pyzo is a python interpreter that runs on the Mac, so it won't be able to find the pyb module.

You need to use a serial terminal program to connect to the serial port and get into the Micropython REPL. Then import pyb will work.

Post Reply