uPycraft with mpy file

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
bellad
Posts: 96
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Fri Dec 20, 2019 8:29 am

toute mes excuses , mon anglais date de tres loin
je voulais dire que mon programme chauf.mpy contient une boucle ' while true ' et que , quand je fais ' import chauf ' rien ne se passait

mais maintenant ça va mieux , il faut que je debug toutes mes erreurs de programmation , car je ne pouvais pas le faire avec chauf.py vu que j'avais un probleme de sram
merci

Christian Walther
Posts: 169
Joined: Fri Aug 19, 2016 11:55 am

Re: uPycraft with mpy file

Post by Christian Walther » Fri Dec 20, 2019 12:26 pm

(response in English for other readers)

It is normal that nothing happens after the first time when using import because the module is cached. In order to run it several times, do

Code: Select all

del sys.modules['chauf']
in between to clear the cache (import sys if needed).

If you have both chauf.py and chauf.mpy in your filesystem, as explained here, .py will be used in preference and may cause a MemoryError if it’s too large to compile. So make sure you only have the .mpy.

bellad
Posts: 96
Joined: Tue May 14, 2019 1:47 pm

Re: uPycraft with mpy file

Post by bellad » Fri Dec 20, 2019 4:13 pm

thank you christian for this

Code: Select all

del sys.modules['chauf'
and
both chauf.py and chauf.mpy in your filesystem
i will test after the holidays

Happy Holidays to all

Post Reply