Skip to content

Python < 3.11: TypeError: to_bytes() missing required argument 'byteorder' (pos 2) #698

@mathoudebine

Description

@mathoudebine

I am using Ubuntu 22.04 and Python 3.10.12 with the 8.8" screen

Getting the following error:

(.venv) root@test:/home/kevin/turing-smart-screen-python# python main.py 
02/25/2025 03:06:36 AM [INFO] Loading theme AMD from res/themes/AMD/theme.yaml
02/25/2025 03:06:37 AM [DEBUG] HW revision: C
02/25/2025 03:06:37 AM [DEBUG] Auto detected COM port: /dev/ttyACM1
02/25/2025 03:06:37 AM [DEBUG] Using Python 3.10.12 (main, Feb  4 2025, 14:57:36) [GCC 11.4.0]
02/25/2025 03:06:37 AM [WARNING] Tray icon is not supported on your platform
02/25/2025 03:06:37 AM [INFO] Initialize display
02/25/2025 03:06:37 AM [INFO] Display reset (COM port may change)...
02/25/2025 03:06:52 AM [DEBUG] Static COM port: /dev/ttyACM1
02/25/2025 03:06:52 AM [DEBUG] HW sub-revision returned: chs_88inch.dev1_rom1.90
02/25/2025 03:06:52 AM [INFO] Calling ScreenOn
02/25/2025 03:06:52 AM [DEBUG] Drawing Image: BACKGROUND
02/25/2025 03:06:52 AM [DEBUG] Bitmap /home/kevin/turing-smart-screen-python/res/themes/AMD/background.png is now loaded in the cache
Traceback (most recent call last):
  File "/home/kevin/turing-smart-screen-python/main.py", line 208, in <module>
    display.display_static_images()
  File "/home/kevin/turing-smart-screen-python/library/display.py", line 125, in display_static_images
    self.lcd.DisplayBitmap(
  File "/home/kevin/turing-smart-screen-python/library/lcd/lcd_comm.py", line 219, in DisplayBitmap
    self.DisplayPILImage(image, x, y, width, height)
  File "/home/kevin/turing-smart-screen-python/library/lcd/lcd_comm_rev_c.py", line 342, in DisplayPILImage
    payload=bytearray(int(self.display_width * self.display_width / 64).to_bytes(2)))
TypeError: to_bytes() missing required argument 'byteorder' (pos 2)

Originally posted by @pragmaticgeek in #691 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions