Page 1 of 1

Could not import 'btree' in MicroPython 1.9.4

Posted: Mon Mar 18, 2019 10:54 am
by lnsri22
Hello EveryOne!!

When I try to import 'btree' module in my pyboardv1.1 running MicroPython 1.9.4, I get this import error stating the absence of the module 'btree'


What am I missing?

Any help is greatly appreciated!!

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Mon Mar 18, 2019 2:19 pm
by jickster
It’s probably not compiled in; you need to define MICROPY_PY_BTREE


Sent from my iPhone using Tapatalk Pro

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Tue Mar 19, 2019 5:05 am
by lnsri22
Thanks jickster for the quick reply there!!


Let me give a try and update!!

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Mon Mar 25, 2019 4:45 pm
by Picasso
Any progress? I couldn't help but notice that BTree is written in c. You probably need to set the right flag, recompile the micropython codebase and create your new firmware for your case.
>>> extmod/modbtree.c
Line 35: #if MICROPY_PY_BTREE

So, set the flag and recompile?

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Mon Mar 25, 2019 4:49 pm
by jickster
Yes that’s correct.


Sent from my iPhone using Tapatalk Pro

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Mon Mar 25, 2019 7:16 pm
by Picasso
Humm ... time for btree module in pure python? Than the user could simply copy the module and continue with this project.
The guys who want to have the c version, can still use the c version.

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Tue Mar 26, 2019 7:30 am
by lnsri22
Picasso wrote:
Mon Mar 25, 2019 4:45 pm
Any progress? I couldn't help but notice that BTree is written in c. You probably need to set the right flag, recompile the micropython codebase and create your new firmware for your case.
>>> extmod/modbtree.c
Line 35: #if MICROPY_PY_BTREE

So, set the flag and recompile?
Thanks Picasso!!

Your suggestion worked like a charm!!

Sorry for the delayed update by the way

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Fri Aug 28, 2020 7:40 am
by hlovatt
The docs don't mention that btree is not normally included in a build. Should the docs say btree not included or should the build include btree?

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Fri Aug 28, 2020 5:25 pm
by pythoncoder

Re: Could not import 'btree' in MicroPython 1.9.4

Posted: Sun Aug 30, 2020 5:32 am
by hlovatt
Thanks. Have issued pull request for documentation noting availability.