ustruct module
-
- Posts: 5
- Joined: Thu Aug 03, 2017 7:40 pm
ustruct module
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?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ustruct module
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,
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.
Index to my micropython libraries.
-
- Posts: 5
- Joined: Thu Aug 03, 2017 7:40 pm
Re: ustruct module
[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
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
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ustruct module
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:
The above was on a standard build installed yesterday. I installed no libraries.
What platform are you using?
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']
>>>
What platform are you using?
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 5
- Joined: Thu Aug 03, 2017 7:40 pm
Re: ustruct module
im currently using the terminal on my raspberry pi2pythoncoder wrote: What platform are you using?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ustruct module
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.
Index to my micropython libraries.
Re: ustruct module
I think he's using regular Python.
-
- Posts: 5
- Joined: Thu Aug 03, 2017 7:40 pm
Re: ustruct module
Thats right, and i tried on many rapsberries pie(2 and 3) and still no module found when i import ustructdeshipu wrote:I think he's using regular Python.
Re: ustruct module
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...
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.
- Description
Steps to Produce/Reproduce
Expected Results
Actual Results
...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."I need the ustruct and the micropython documentation send me there"
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.