pimoroni / EnviroPlus-FeatherWing

CircuitPython library for the Enviro+ FeatherWing
https://shop.pimoroni.com/products/enviro-plus-featherwing
MIT License
10 stars 11 forks source link

Make example name compatible with import #6

Closed dglaude closed 3 years ago

dglaude commented 4 years ago

I had trouble to test the example using import. Avoiding the caracter "-" and "&" and replacing this by "_" would help.

import bme280_simple

Gadgetoid commented 4 years ago

Is there a specific reason why you might import examples in this way?

dglaude commented 4 years ago

Well, how else do you run them? Rename them to main.py?

Typically I would run them from the REPL, or have a main.py that import the example I want to run.

Any other reason why in the "low-mem" example you provide as *.MPY files do not use "-"?

Gadgetoid commented 4 years ago

Beats me - https://github.com/pimoroni/EnviroPlus-FeatherWing/graphs/contributors 😆

I had as little to do with writing this library as I could possibly muster and my experience with MicroPython extends to the BBC micro:bit where the concept of importing anything longer than a few lines is entirely alien and blows the memory limit. These questions are sincere.

I'm guessing you can preload all of the examples onto the device and run the ones you want using import?

tannewt commented 4 years ago

@Gadgetoid A few folks use import to run a particular example without having to rename it to the generic code.py

Gadgetoid commented 3 years ago

That makes sense. Thanks!

As I eluded- trying to do that on micro:bit would be bad times, which is why I always preferred PXT/MakeCode.

dglaude commented 3 years ago

Let's close this.