Could not import 'btree' in MicroPython 1.9.4

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
lnsri22
Posts: 66
Joined: Fri Aug 17, 2018 12:16 pm
Location: India

Could not import 'btree' in MicroPython 1.9.4

Post by lnsri22 » Mon Mar 18, 2019 10:54 am

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!!
lnsri22 :)

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Could not import 'btree' in MicroPython 1.9.4

Post by jickster » Mon Mar 18, 2019 2:19 pm

It’s probably not compiled in; you need to define MICROPY_PY_BTREE


Sent from my iPhone using Tapatalk Pro

lnsri22
Posts: 66
Joined: Fri Aug 17, 2018 12:16 pm
Location: India

Re: Could not import 'btree' in MicroPython 1.9.4

Post by lnsri22 » Tue Mar 19, 2019 5:05 am

Thanks jickster for the quick reply there!!


Let me give a try and update!!
lnsri22 :)

Picasso
Posts: 39
Joined: Fri Mar 22, 2019 12:13 pm

Re: Could not import 'btree' in MicroPython 1.9.4

Post by Picasso » 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?

jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

Re: Could not import 'btree' in MicroPython 1.9.4

Post by jickster » Mon Mar 25, 2019 4:49 pm

Yes that’s correct.


Sent from my iPhone using Tapatalk Pro

Picasso
Posts: 39
Joined: Fri Mar 22, 2019 12:13 pm

Re: Could not import 'btree' in MicroPython 1.9.4

Post by Picasso » Mon Mar 25, 2019 7:16 pm

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.

lnsri22
Posts: 66
Joined: Fri Aug 17, 2018 12:16 pm
Location: India

Re: Could not import 'btree' in MicroPython 1.9.4

Post by lnsri22 » Tue Mar 26, 2019 7:30 am

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
lnsri22 :)

Post Reply