.pyc files

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
KJM
Posts: 158
Joined: Sun Nov 18, 2018 10:53 pm
Location: Sydney AU

.pyc files

Post by KJM » Thu Jan 27, 2022 7:51 am

I'm tempted to have a go with mpy_cross to make a .pyc file for an ESP32. Decided to dry run the idea first since getting the cross compiler working on windows sounded complicated. I managed to make a .pyc of a simple 1 line print('hello world') program in IDLE.

Code: Select all

hello world
>>> import py_compile
>>> py_compile.compile('test.py')
'__pycache__\\test.cpython-39.pyc'
First thing I've learned is no repl will run a .pyc file. Is it fair to say that if I manage to get the cross compiler working, the only way to validate it would be to save the output as main.mpy, load it onto an ESP32 & hope for the best when I press reset?

Post Reply