Does anybody have a suggestion for (non commercial) software to decompile "byte-code" Python (.pyc) files?

Everything I've found seems to break...


What Python version you're decompiling? Py3k is not well supported, but there are quite a few decompilers for 2.x. One of the latest projects is this:


It runs on Python 2.7 but supports decompiling 2.5 to 2.7.

Note that some commercial projects has been known to use modified Python interpreters. Modifications can include:

  • bytecode files encryption
  • changed opcode values or additional opcodes
  • a heavily customized runtime (e.g. Stackless Python)

If you need to handle this, one approach is to convert non-standard bytecode to standard one and then use the usual decompilers (this apparently was used by the people from above project to decompile Dropbox code). Another is to change the decompiler to directly support the variations.

| improve this answer | |

You might find pyREtic from Immunity to be useful. The presentation from BlackHat USA 2010 on pyREtic is here (YouTube).


Reverse Engineer Obfuscated Python Bytecode This toolkit allows you to take a object in memory back to source code, without needing access to the bytecode directly on disk. This can be useful if the applictions pyc's on disk are obfuscated in one of many ways.

| improve this answer | |

I, of course, use uncompyle6. Disclaimer: I work on this project.

I've written at length about the uncompyle6 and pycdc here.

| improve this answer | |

For initial and rough Python bytecode disassembly, I would be using the Python standard library dis module: https://docs.python.org/2/library/dis.html

| improve this answer | |

There is also an open-source Python (.pyc) decompiler, called Decompyle++

Decompyle++ aims to translate compiled Python byte-code back into valid and human-readable Python source code. While other projects have achieved this with varied success, Decompyle++ is unique in that it seeks to support byte-code from any version of Python.

| improve this answer | |

Here is what you're looking for, I just came across a fully working Python decompiler named "Easy Python Decompiler".

| improve this answer | |

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.