Precedence of frozen bytecode

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
Hanilein
Posts: 29
Joined: Thu Jul 12, 2018 11:40 am
Location: Christchurch, New Zealand

Precedence of frozen bytecode

Post by Hanilein » Sun Mar 15, 2020 1:46 am

Hello,

after having managed to freeze modules and deploy them to a Pyboard, I found, that the frozen module is always used, even when an module with the same name is available on the SD-card.

That poses a slight challenge: In case of improvements or patches the firmware has to be updated, it is not possible to 'patch' a faulty or insufficient module by just supplying the module with the same name on the SD-card.

Is there a solution available?

Thank you very much.
Ivo Gorny


Hanilein
Posts: 29
Joined: Thu Jul 12, 2018 11:40 am
Location: Christchurch, New Zealand

Re: Precedence of frozen bytecode

Post by Hanilein » Sun Mar 15, 2020 2:54 am

Thanks, Dave!

Lightning fast response, and it works like a charm.

I put this at the start of the main.py:

Code: Select all

import sys
sys.path[0]='/sd'
sys.path[1]=''
This reverses the order.

Thanks a lot!
Ivo Gorny

Post Reply