does mpy take precedence over py?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
smhodge
Posts: 86
Joined: Tue Jan 22, 2019 2:16 am
Location: Kirkland, WA, USA

does mpy take precedence over py?

Post by smhodge » Sun May 17, 2020 6:10 pm

If you have both a x.py and x.mpy file on /flash or /sd, does the x.mpy file take precedence and get loaded, and the x.py file ignored?

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: does mpy take precedence over py?

Post by aivarannamaa » Sun May 17, 2020 6:45 pm

It seems to be vice versa:

https://docs.micropython.org/en/latest/ ... files.html
When searching a particular directory foo.py is looked for first and if that is not found then foo.mpy is looked for, then the search continues in the next directory if neither is found. As such, foo.py will take precedence over foo.mpy.
Aivar Annamaa
https://thonny.org

Post Reply