{"id":24446,"library":"python-escpos","title":"python-escpos","description":"Library to manipulate ESC/POS printers. Supports USB, serial, network, and file interfaces. Current version is 3.1 (released 2024-04-07). Requires Python >=3.8.","status":"active","version":"3.1","language":"python","source_language":"en","source_url":"https://github.com/python-escpos/python-escpos","tags":["escpos","thermal printer","receipt printer","usb","serial","network"],"install":[{"cmd":"pip install python-escpos","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"USB printer support (optional, only if using USB backend)","package":"pyusb","optional":true},{"reason":"Serial printer support (optional, only if using serial backend)","package":"pyserial","optional":true},{"reason":"Barcode generation (optional, only if using software barcodes)","package":"python-barcode","optional":true},{"reason":"Image handling (optional, for image printing)","package":"Pillow","optional":true}],"imports":[{"note":"Old import path from v2.x; v3.x requires full path from submodule","wrong":"from escpos import Usb","symbol":"Usb","correct":"from escpos.printer import Usb"},{"note":"Same as above","wrong":"from escpos import Serial","symbol":"Serial","correct":"from escpos.printer import Serial"},{"note":"Same as above","wrong":"from escpos import Network","symbol":"Network","correct":"from escpos.printer import Network"},{"note":"Same as above","wrong":"from escpos import File","symbol":"File","correct":"from escpos.printer import File"}],"quickstart":{"code":"from escpos.printer import Usb\n\n# Replace with your printer's USB vendor and product IDs\np = Usb(0x04b8, 0x0202, in_ep=0x82, out_ep=0x01)\np.text(\"Hello World\\n\")\np.image(\"logo.png\")\np.barcode(\"1234567890128\", \"EAN13\", height=100)\np.cut()","lang":"python","description":"Basic usage: open USB printer, print text, image, barcode, and cut paper."},"warnings":[{"fix":"Upgrade to Python >=3.8.","message":"Python 2 support dropped in v3.0. Code relying on Python 2 will break.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Use `from escpos.printer import Usb` (and similarly for Serial, Network, File).","message":"Import paths changed in v3.0. Printer classes moved to `escpos.printer` submodule. Old imports like `from escpos import Usb` no longer work.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Use the specific printer class from `escpos.printer`.","message":"`escpos.escpos.Escpos` base class no longer directly importable. The API for creating printer instances changed.","severity":"breaking","affected_versions":">=3.0"},{"fix":"Set up udev rules for your printer or run as root.","message":"USB printer requires `pyusb` and often root/sudo permissions on Linux. Without proper permissions, `Usb` initialization will fail with USBError.","severity":"gotcha","affected_versions":"*"},{"fix":"Ensure `python-escpos` is installed correctly; the capabilities are bundled. Alternatively, load a custom capabilities file.","message":"Capabilities file must be present for the library to know printer features. If missing, printing may produce garbage or no output.","severity":"gotcha","affected_versions":">=3.0"},{"fix":"Use `high_density=True` instead of `impl='bitImageColumn'`.","message":"`escpos.escpos.Escpos.image()` method's parameters changed: `impl` parameter is deprecated in favor of `high_density`.","severity":"deprecated","affected_versions":">=3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure the barcode data is the correct length. For EAN13, provide 12 or 13 numeric digits.","cause":"Barcode data length or checksum incorrect. EAN13 requires 13 digits (or 12 with automatic checksum).","error":"ValueError: Invalid barcode: '1234567890128' (EAN13) must be 12 or 13 digits."},{"fix":"Check your printer's capabilities and use a different command or update capabilities file.","cause":"Printer does not support the given command (capability issue).","error":"escpos.exceptions.SetVariableError: Set variable failed for 'some_command'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}