ustruct module

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
crisdleon17
Posts: 5
Joined: Thu Aug 03, 2017 7:40 pm

ustruct module

Post by crisdleon17 » Thu Aug 03, 2017 7:51 pm

hello, im in some kind of trouble, i downloaded the micropython modules of github(this repository:https://github.com/micropython/micropython-lib) since I need the ustruct and the micropython documentation send me there, but after I cloned the git and installed everything, I still dont have de module, any idea of what I should do, or if I'm missing something obvious?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ustruct module

Post by pythoncoder » Fri Aug 04, 2017 6:23 am

The README at the link you posted gives information on how to install library modules.

There is a slight "gotcha" in that the method presupposes an internet connection. Problematic for targets with no network interface. My solution to this is to install to the Unix build, then copy the library files from ~/.micropython/lib to the target,
Peter Hinch
Index to my micropython libraries.

crisdleon17
Posts: 5
Joined: Thu Aug 03, 2017 7:40 pm

Re: ustruct module

Post by crisdleon17 » Mon Aug 07, 2017 6:16 am

[quote="pythoncoder"]The README at the link you posted gives information on how to install library modules.

There is a slight "gotcha" in that the method presupposes an internet connection. Problematic for targets with no network interface. My solution to this is to install to the Unix build, then copy the library files from ~/.micropython/lib to the target,[/quote]

my problem isnt how to install it and stuff, is more about the content that gets installed, since what I need is Ustruct, but what I get is Struct, and sadly it import from Ustruct which is exactly what I dont have

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ustruct module

Post by pythoncoder » Mon Aug 07, 2017 7:46 am

Sorry, I'm still not following you. The ustruct module should not need installing as, like the other libraries listed here [url]file:///mnt/qnap2/data/Projects/MicroPython/micropython/docs/build/esp8266/html/library/index.html#python-standard-libraries-and-micro-libraries[/url], it's included in the standard build. On every platform I've tried I can issue:

Code: Select all

MicroPython v1.9.1-394-g79feb956 on 2017-08-06; ESP32 module with ESP32
Type "help()" for more information.
>>> 
>>> import ustruct
>>> dir(ustruct)
['__name__', 'calcsize', 'pack', 'pack_into', 'unpack', 'unpack_from']
>>> 
The above was on a standard build installed yesterday. I installed no libraries.

What platform are you using?
Peter Hinch
Index to my micropython libraries.

crisdleon17
Posts: 5
Joined: Thu Aug 03, 2017 7:40 pm

Re: ustruct module

Post by crisdleon17 » Mon Aug 07, 2017 2:31 pm

pythoncoder wrote: What platform are you using?
im currently using the terminal on my raspberry pi2

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: ustruct module

Post by pythoncoder » Tue Aug 08, 2017 4:36 am

My above test produces the same result here on the Unix build. If that's what you're using rather than the experimental "bare metal" Raspberry Pi port, it might be worth updating your source tree and recompiling the Unix build.
Peter Hinch
Index to my micropython libraries.

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: ustruct module

Post by deshipu » Tue Aug 08, 2017 7:43 am

I think he's using regular Python.

crisdleon17
Posts: 5
Joined: Thu Aug 03, 2017 7:40 pm

Re: ustruct module

Post by crisdleon17 » Mon Aug 14, 2017 6:54 pm

deshipu wrote:I think he's using regular Python.
Thats right, and i tried on many rapsberries pie(2 and 3) and still no module found when i import ustruct

cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Re: ustruct module

Post by cefn » Mon Aug 14, 2017 7:23 pm

It's worth reading up on how to raise a bug report. They tend to include at least the following, which attempt to detail what you were trying to achieve, and what actually happened...
  • Description
    Steps to Produce/Reproduce
    Expected Results
    Actual Results
You have asserted...
"I need the ustruct and the micropython documentation send me there"
...but not explained what you are trying to achieve, where you plan to run your code, what it is meant to do and other important things.

In particular, if you are NOT trying to run code on a platform with very few resources (such as a microcontroller intended for 'embedded' deployment in your own gadgets) then you would most likely not use micropython at all.

The Raspberry Pi has a huge amount of resources compared to the platforms targeted by Micropython. It is perfectly able to run the full versions of Python2 or Python3 so if you are not able to articulate why you are trying to run your code in Micropython, you probably shouldn't.

If you were planning to write your code and run it in Python3 anyway, then attempting to use Micropython resources, library, forum or issue tracker makes little sense.

For the future, take a look at https://www.chiark.greenend.org.uk/~sgtatham/bugs.html which is a good summary of the issues when trying to seek help on a forum or issue tracker.

Post Reply