How can I get the source code of a Python module?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
lipapave@seznam.cz
Posts: 4
Joined: Sat Oct 09, 2021 7:06 pm

How can I get the source code of a Python module?

Post by lipapave@seznam.cz » Sun Oct 10, 2021 8:34 pm

Hello,

is it possible on ESP32 to get or print the source of code of python module e.g (code of module hello.py) ?

hello.py

Code: Select all

print("Hello")
I found this on google https://stackoverflow.com/questions/427 ... n-function
but on ESP32 the inspect library is simplified and does not work. Is there a better way, than inspect library?

neveregret
Posts: 28
Joined: Sun Aug 08, 2021 5:48 pm

Re: How can I get the source code of a Python module?

Post by neveregret » Mon Oct 11, 2021 5:10 am

lipapave@seznam.cz wrote:
Sun Oct 10, 2021 8:34 pm
Hello,

is it possible on ESP32 to get or print the source of code of python module e.g (code of module hello.py) ?

hello.py

Code: Select all

print("Hello")
I found this on google https://stackoverflow.com/questions/427 ... n-function
but on ESP32 the inspect library is simplified and does not work. Is there a better way, than inspect library?
Are you looking for this https://www.microdev.it/wp/en/2018/08/0 ... for-esp32/ .You can make changes with source code when you install them inside esp file.

lipapave@seznam.cz
Posts: 4
Joined: Sat Oct 09, 2021 7:06 pm

Re: How can I get the source code of a Python module?

Post by lipapave@seznam.cz » Mon Oct 11, 2021 7:15 am

Yes, I use this source code. The problem is, that my laptop disk was damaged and all /ports/esp32/modules was lost. Only what I have is firmware.bin. Is there way, how can I get modules from firmware.bin or from running code on ESP32 ?:

Post Reply