On this page
  1. struct.error
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

struct.error

Prev: struct.calcsize | Up: struct | Next: struct.iter_unpack
Rel: struct.calcsize, struct.iter_unpack, struct.pack, struct.pack_into
Ref: docs.python.org โ€” struct.error
Tags: #public #python3 #stdlib #struct


Import

import struct
from struct import error

Signature & Overview

struct.error(...)

struct.error class.

Methods & Attributes

Usage

import struct

try:
    struct.unpack("!I", b"\x01\x02")
except struct.error as exc:
    assert "4 bytes" in str(exc)

Gotchas

REPL Inspect

from struct import error
help(error)

Linked from

Related notes