Skip to content

Syntax error with 1.10.2 running on PiOS #44

Closed
@Ricker42

Description

@Ricker42

I have adafruit-circuitpython-typing version 1.10.2 installed via pip3 on a Raspberry Pi 3B+ running "Raspbian GNU/Linux 10 (buster)". I did just do "apt-get update" and "apt-get upgrade" today (Nov 12 2024) so I'm at the latest of everything.

I was trying to set up and use an OLED display, but am getting the following error just during the import section:

Traceback (most recent call last):
  File "oled_demo.py", line 5, in <module>
    import adafruit_ssd1306
  File "/usr/local/lib/python3.7/dist-packages/adafruit_ssd1306.py", line 17, in <module>
    from adafruit_bus_device import i2c_device, spi_device
  File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/i2c_device.py", line 15, in <module>
    from circuitpython_typing import ReadableBuffer, WriteableBuffer
  File "/home/pi/.local/lib/python3.7/site-packages/circuitpython_typing/__init__.py", line 79
    def read(self, count: Optional[int] = None, /) -> Optional[bytes]:
                                                ^
SyntaxError: invalid syntax

The code that produces this is

# Load needed modules
import board
import digitalio
from PIL import Image, ImageDraw, ImageFont
import adafruit_ssd1306

I looked at the referenced __init__.py and changed lines 79 and 86 to remove ", /" from the def lines, and all the code then works and I can display something.

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