Hi,
I'm a newbie to python and a newbie to micropython so I don't even know the proper terms to ask the question!
I've got a small python application that is running on a Windows PC. I want to see if micropython will run the application on our embedded system. To do that, I thought I'd run micropython on a Windows PC first (as we've not got micropython available yet on the embedded system). I've compiled up the source and can run a hello world program.
When I run the application, it fails on "import parseargs". How do I go about installing modules? Every time I try and find the answer, it's mainly about how to get it installed on "boards" (or something). I'm sure I got further with this a few months ago but can't seem to find the pages I found before so I know it's a pretty stupid question but I'm stuck!
I think we use PIP with the normal python for this sort of thing.
Thanks.
Peter.
Newbie question - PIP?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Newbie question - PIP?
I suggest you read https://github.com/micropython/micropyt ... ifferences.
tl;dr MicroPython is primarily designed to run on microcontrollers. These are resource constrained. Consequently many of the standard Python libraries are not supported. In some cases 'micro' versions of standard libraries are offered.
tl;dr MicroPython is primarily designed to run on microcontrollers. These are resource constrained. Consequently many of the standard Python libraries are not supported. In some cases 'micro' versions of standard libraries are offered.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Newbie question - PIP?
Hi,
Thanks for the reply. I read most of that page. I could be OK. It all depends on library support. I found a link that page to this one -
https://github.com/micropython/micropython-lib
The first library I was looking for is listed there (argparse) so I downloaded that and put the "argparse" folder in the same folder as my script and it now doesn't complain about the import. So that's great.
Is there another place that I can put it though? I don't really like it mixed up with my own code.
Thanks.
Peter.
Thanks for the reply. I read most of that page. I could be OK. It all depends on library support. I found a link that page to this one -
https://github.com/micropython/micropython-lib
The first library I was looking for is listed there (argparse) so I downloaded that and put the "argparse" folder in the same folder as my script and it now doesn't complain about the import. So that's great.
Is there another place that I can put it though? I don't really like it mixed up with my own code.
Thanks.
Peter.
Re: Newbie question - PIP?
You can control the location using sys.path
By default, sys.path has /flash, /flash/lib, /sd, /sd/lib (the /sd paths only exist if an sd card is inserted). You can append to that or otherwise modify it as you see fit.
By default, sys.path has /flash, /flash/lib, /sd, /sd/lib (the /sd paths only exist if an sd card is inserted). You can append to that or otherwise modify it as you see fit.