Adding Modules



  • Hi All,

    Having some trouble adding modules to my LoPy (with Expansion Board 2.0). In particular, one I am trying to add is (u)requests. If I take the urequests folder from https://github.com/micropython/micropython-lib and throw it in /flash/lib, I can import it, but urequests.<anything> (like urequests.get()) doesn't work, and dir(urequests) gives name and file only. Same thing if I put it on the micro sd card (with it mounted as /sd/ and that added to sys.path).

    Rather than the folder itself, if I paste the files from inside it into /flash/lib, dir(urequests) shows all of urequest's functions. While this lets me use it, it doesn't let me add other modules, as they'll each have a setup.py.

    Do I need to add the folder from each module I add to sys.path (e.g. /flash/lib/urequests, /flash/lib/ssl, ..., etc.)? I have searched around quite a bit and didn't see anything saying that is the right way to do it. On the contrary, the first way I tried seemed to be the prescribed method.

    Thank you for the assistance.


 

Hello World?

Pylife on Kickstarter - November 2018








Back Us On Kickstarter >

Pycom on Twitter