Newbie question - PIP?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Miffo
Posts: 2
Joined: Thu Mar 16, 2017 10:31 am

Newbie question - PIP?

Postby Miffo » Thu Mar 16, 2017 10:35 am

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.

User avatar
pythoncoder
Posts: 1382
Joined: Fri Jul 18, 2014 8:01 am

Re: Newbie question - PIP?

Postby pythoncoder » Fri Mar 17, 2017 7:10 am

I suggest you read https://github.com/micropython/micropython/wiki/Differences.

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

Miffo
Posts: 2
Joined: Thu Mar 16, 2017 10:31 am

Re: Newbie question - PIP?

Postby Miffo » Fri Mar 17, 2017 3:00 pm

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.

User avatar
dhylands
Posts: 2260
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: Newbie question - PIP?

Postby dhylands » Fri Mar 17, 2017 4:20 pm

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.


Return to “General Discussion and Questions”

Who is online

Users browsing this forum: No registered users and 1 guest