Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.

When trying to run python3 printertest.py I get a termios.error: (25, 'Inappropriate ioctl for device') errorΒ #57

@threalboss

Description

@threalboss

When trying to run python3 printertest.py (on my pi zero w) I get the error:

File "/home/pi/.local/lib/python3.9/site-packages/serial/serialposix.py", line 398, in _reconfigure_port
    orig_attr = termios.tcgetattr(self.fd)
termios.error: (25, 'Inappropriate ioctl for device')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/Python-Thermal-Printer/printertest.py", line 5, in <module>
    printer = Adafruit_Thermal("/dev/usb/lp0", 9600, timeout=5)
  File "/home/pi/Python-Thermal-Printer/Adafruit_Thermal.py", line 84, in __init__
    Serial.__init__(self, *args, **kwargs)
  File "/home/pi/.local/lib/python3.9/site-packages/serial/serialutil.py", line 244, in __init__
    self.open()
  File "/home/pi/.local/lib/python3.9/site-packages/serial/serialposix.py", line 332, in open
    self._reconfigure_port(force_update=True)
  File "/home/pi/.local/lib/python3.9/site-packages/serial/serialposix.py", line 401, in _reconfigure_port
    raise SerialException("Could not configure port: {}".format(msg))
serial.serialutil.SerialException: Could not configure port: (25, 'Inappropriate ioctl for device')

In printertest.py I change the printer setup line to:
printer = Adafruit_Thermal("/dev/usb/lp0", 9600, timeout=5)

This is because I could only get the first test to work with /dev/usb/lp0 and my print test page said it is 9600.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions