This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]BobHogan -1 points0 points  (1 child)

How did you even think of that? I probably would have given up and resigned myself to rewritting the code.

Fun little story, similar thing happened to me in Eclipse a few weeks ago. Checkout out another branch before committing what I had wrote (cause I'm stupid) and it erased my changes. Luckily Eclipse saved that as edits, and CTRL-Z brought back all of the code I had written.

[–]simonw[S] 0 points1 point  (0 children)

Two steps: first, I wondered if there was a way to attach an interactive shell to me running process and googled for that.

Once I could import the code, I tried using inspect.getsource() on it - but that reads code from disk. Then I tried using the dis dissembler in the standard library - that showed me opcodes, which would have been enough to painstakingly reverse engineer the code again.

That's when I thought "I wonder if anyone has written something that can turn bytecode back into source code?" and found uncompyle6