{"id":21115,"library":"decompyle3","title":"decompyle3","description":"Python cross-version byte-code decompiler targeting Python 3.7-3.8 bytecode. Current version is 3.9.3 (2025). Releases are sporadic, roughly once per year. Requires xdis (6.x) and spark-parser. Supports running on CPython up to 3.13 but only decompiles bytecode up to 3.8.","status":"active","version":"3.9.3","language":"python","source_language":"en","source_url":"https://github.com/rocky/python-decompile3/","tags":["decompiler","bytecode","Python 3","reverse-engineering"],"install":[{"cmd":"pip install decompyle3","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Required for bytecode disassembly and interpretation","package":"xdis","optional":false},{"reason":"Required for parsing decompiled tokens","package":"spark-parser","optional":false}],"imports":[{"note":"main entry point","symbol":"decompile","correct":"from decompyle3 import decompile"},{"note":"decompile a .pyc file to string","symbol":"decompile_file","correct":"from decompyle3 import decompile_file"}],"quickstart":{"code":"from decompyle3 import decompile_file\nimport sys\n# Decompile a .pyc file and print source\nout = sys.stdout\nwith open('example.pyc', 'rb') as fp:\n    decompile_file(out, fp)\n","lang":"python","description":"Decompile a .pyc file to stdout. Requires Python 3.7-3.8 bytecode."},"warnings":[{"fix":"Use uncompyle6 for Python 2.7-3.8, or try pycdc/decompyle3-fork for newer bytecode.","message":"decompyle3 only decompiles Python 3.7 and 3.8 bytecode. It cannot decompile bytecode from Python 3.9+.","severity":"breaking","affected_versions":"all"},{"fix":"Use a virtual environment to isolate decompyle3 from other projects with different xdis requirements.","message":"The package requires xdis version 6.x, which may conflict with other tools that require xdis 5.x or 4.x.","severity":"gotcha","affected_versions":">=3.8.0"},{"fix":"Install and run `decompyle3 filename.pyc`.","message":"Command-line tool is `decompyle3`, not `decompyle`. Running `decompyle` will fail with 'command not found'.","severity":"gotcha","affected_versions":"all"},{"fix":"Install uncompyle6 for Python 2 decompilation.","message":"Support for Python 2.x has been removed. Use uncompyle6 for Python 2.7.","severity":"deprecated","affected_versions":">=3.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from decompyle3 import decompile' (decompyle3 with a 'y').","cause":"Mis-typed package name in import (decompile3 vs decompyle3). Note the 'y' in decompyle3.","error":"ImportError: cannot import name 'decompile' from 'decompile3'"},{"fix":"Only decompile .pyc files generated by Python 3.7 or 3.8. Check Python version with 'head -c 4 file.pyc | od -An -tu4'.","cause":"Trying to decompile a .pyc file from Python 3.9+ which uses a different magic number and bytecode format.","error":"ValueError: bad marshal data (unknown type code)"},{"fix":"Install xdis: 'pip install xdis'. Make sure you have xdis 6.x.","cause":"Missing required dependency xdis.","error":"ModuleNotFoundError: No module named 'xdis'"},{"fix":"Upgrade xdis to version 6.x: 'pip install \"xdis>=6,<7\"'.","cause":"Incompatible xdis version (e.g., xdis 5.x instead of 6.x).","error":"AttributeError: module 'xdis' has no attribute 'PYTHON_VERSION'"},{"fix":"Use a different decompiler for Python 3.9+ (e.g., uncompyle6 does not work either; try pycdc or wait for decompyle3 updates).","cause":"decompyle3 cannot decompile bytecode from Python 3.9+.","error":"RuntimeError: Unsupported Python version 3.9"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}