Page 1 of 1

Compiling in unix and no "struct" module available

Posted: Sat Jun 13, 2015 6:06 pm
by cloudformdesign
I can't seem to get the struct module when compiling in the unix folder

Code: Select all

$ cd unix
$ make
$ ./micropython 
Micro Python v1.4.3-150-ga19ba5f on 2015-06-13; linux version
>>> import struct
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'struct'
Am I doing something wrong here?

Re: Compiling in unix and no "struct" module available

Posted: Sat Jun 13, 2015 6:24 pm
by cloudformdesign
so it does work after the following:

Code: Select all

micropython-pip install micropython-struct
However I thought struct was supposed to be in the standard library.

Re: Compiling in unix and no "struct" module available

Posted: Sat Jun 13, 2015 6:29 pm
by pfalcon
MicroPython doesn't come with "struct" builtin, only "ustruct", which provides subset of functionality. More complete "struct" is in micropython-lib indeed, but "micropython-pip" is deprecated, since about a week, it's:

Code: Select all

micropython -m upip install micropython-struct