Skip to main content

Python byte-code to source-code converter

Project description

A Python 2.7 byte-code decompiler, written in Python 2.7

Version 0.13, 2012-2-22


Note: this package is not likely to change, and has been largely superseded by: uncompyle6

uncompyle2 converts Python byte-code back into equivalent Python source. It accepts byte-code from CPython version 2.7 and runs on Python 2.7 only.

The generated source pretty prints docstrings, lists, tuples and hashes.

uncompyle2 may also verify the equivalence of the generated source by by compiling it and comparing both byte-codes.

This code is based on John Aycock’s generic small languages compiler spark and his prior work on a tool called decompyle. It was vastly improved by Hartmut Goebel.


  • decompiles Python byte-code into equivalent Python source
  • pretty-prints docstrings, hashes, lists and tuples
  • reads directly from .pyc/.pyo files, bulk-decompile whole directories
  • output may be written to file, a directory or to stdout
  • option for including byte-code disassembly into generated source


uncompyle2 -h       # prints short usage
uncompyle2 --help   # prints long usage

Known Bugs/Restrictions

Runs on Python 2.7 only and handles bytecodes from 2.5-2.7. For something that runs on Python 2.6, 2.7, 3.2. 3.3, 3.4 and 3.5 and handles bytecodes from 2.5-3.5, see uncompyle6.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for uncompyle2, version 1.1
Filename, size File type Python version Upload date Hashes
Filename, size uncompyle2-1.1.tar.gz (351.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page