base64 module not found

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
mflmartin
Posts: 43
Joined: Sat Jul 23, 2016 7:30 pm

base64 module not found

Post by mflmartin » Tue Mar 02, 2021 7:30 pm

When I try to import base64 or ubase64, I get no module named base64:

Is there anything that have to be done in order to activate it? Thanks so much.

Code: Select all


MicroPython v1.13 on 2020-09-02; ESP32 module with ESP32
Type "help()" for more information.
>>> import base64
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'base64'
>>> import ubase64
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'ubase64'


mflmartin
Posts: 43
Joined: Sat Jul 23, 2016 7:30 pm

Re: base64 module not found

Post by mflmartin » Tue Mar 02, 2021 8:46 pm

I guess that I needed to install it with upip, and I did, after connecting the module to the wifi.

But this brings me to the next question: What would be the best way to install it in a new device automatically? (Without having to buiild micropython from sources). I am guessing, maybe, checking if it exists in the boot.py or in the main process and install it if it doesn't, or is there another recommended way?

Thanks!

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

Re: base64 module not found

Post by jimmo » Wed Mar 03, 2021 5:41 am

mflmartin wrote:
Tue Mar 02, 2021 8:46 pm
But this brings me to the next question: What would be the best way to install it in a new device automatically? (Without having to buiild micropython from sources). I am guessing, maybe, checking if it exists in the boot.py or in the main process and install it if it doesn't, or is there another recommended way?
I guess your new device also needs to have main.py (and potentially other files) copied anyway.

With previous projects I've had a script (a Makefile) with two targets: deploy and update. So deploy does a "first install" and copies all relevant files to the device (using pyboard.py). update just copies my code (i.e. it assumes things like base64.py and other libraries don't change).

You could also take a look at rshell which has a way to synchronise the host directory with the target (without copying every file every time).

(I guess what I'm saying is that you should have a directory on your PC, probably in source control, that mirrors the fileystem layout of the device, and the question is really a matter of how to synchronise that directory to the device).

Post Reply