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

Introduction

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.

Features

  • 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

Usage

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.

See Also

Project details


Download files

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

Source Distribution

uncompyle2-1.1.tar.gz (351.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page