qwasm

raw JSON →
1.0.1 verified Mon Apr 27 auth: no python

qwasm is a pure-Python WebAssembly decoder and disassembler. It parses WebAssembly binary modules into an intermediate representation and supports disassembly to WAT-like text format. Current version 1.0.1.

pip install qwasm
error AttributeError: module 'qwasm' has no attribute 'disassemble'
cause Incorrect import or missing module; the function might be named differently.
fix
Check the documentation; try import qwasm.disassemble or from qwasm import disassemble. Actually, current API: from qwasm import parse_module; then use qwasm.disassemble(module). This error can happen if you forgot to assign the parse result.
error TypeError: expected bytes, not str
cause Passing a filename string instead of bytes to parse_module.
fix
Read the file with open('file.wasm', 'rb') as f: data = f.read() and pass data.
gotcha qwasm.parse_module() expects bytes, not a file path.
fix Open the file in binary mode and pass the bytes object.
gotcha The library is in early development (v1.0.1); API may change without notice.
fix Pin to a specific version and watch the repository for updates.

Load a WebAssembly binary, parse it, and print the disassembly.

import qwasm

# Assuming 'sample.wasm' exists in the current directory
with open('sample.wasm', 'rb') as f:
    data = f.read()

module = qwasm.parse_module(data)
print(qwasm.disassemble(module))