As per the title. If I have an ESP32 with some Python loaded, and have lost the source, can I retrieve it from the ESP32?

  • Looks like an X-Y question in the making to me... Oct 8, 2019 at 16:10
  • 1
    Nope, it's a two stager. It makes no sense at all to ask the second question ifd the answer to the first is "no". Oct 9, 2019 at 6:36

1 Answer 1


In most cases (that is, unless you have compiled/frozen the Python code), yes.

Depending on the exact environment you may be able to just retrieve the file via the usual file transfer tools.

Alternatively, you can just connect to the REPL (console) and read the file from the filesystem:

file = open("fileyouwanttoread", "r")

This will display the contents of the file. You can then just copy and paste, and voilà!

You can find more examples of reading and writing files in this tutorial.

  • Welcome aboard. Thanx a 1,000,000. That's my answer. Now I just need to figure out how to compile my Python before loading to processor, to make reverse engineering a little harder. Oct 8, 2019 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.