Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to recovery source python code (.py) from .pyo file?

I need to convert a compiled python code (.pyo) to its source . I look in depython.net, but there is a problem. A warning;

"File version older than 2.4."

What should I do?

Thanks.

like image 640
celka Avatar asked Mar 13 '10 13:03

celka


2 Answers

try these:

uncompyle2 converts Python byte-code back into equivalent Python source code. It accepts byte-code from Python version 2.5 to 2.7. Additionally, it will only run on Python 2.7.

uncompyle6 translates Python bytecode back into equivalent Python source code. It accepts bytecodes from Python version 1.5 to 3.7 or so including Pypy-generated bytecode. The code requires Python 2.4 or later and has been tested on Python running versions 2.4, 2.5, 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 and 3.6.

like image 139
iraj jelodari Avatar answered Sep 28 '22 07:09

iraj jelodari


Try decompyle.

This has become a commercial service.
To experiment with it you can use Debian Packages.

I would have loved to try it but I am on a windows machine. I will try it as soon as I get a chance.

like image 33
Pratik Deoghare Avatar answered Sep 28 '22 08:09

Pratik Deoghare