Skip to content

Example code is broken 'object has no such attribute' #25

Open
@spuder

Description

@spuder

Setup

Circuit Python 7.20230112.zip
Raspberry Pi Pico

Problem

If a user attempts to follow the instructions to set this up, they will run into the following problems.

  1. The instructions call for running this code
    https://learn.adafruit.com/adafruit-neotrellis/circuitpython-code#circuitpython-and-python-usage-3002750
import time
from board import SCL, SDA
import busio
from adafruit_neotrellis.neotrellis import NeoTrellis

#create the i2c object for the trellis
i2c_bus = busio.I2C(SCL, SDA)

#create the trellis
trellis = NeoTrellis(i2c_bus)

Which will produce error

ImportError: cannot import name SCL

  1. If a user attempts to use the example from the example directory, they will encounter this error

AttributeError: 'module' object has no attribute 'I2C'

As a result, most users who aren't experienced python developers will likely give up.

Additional Information

  1. The guide for Trellis was released in September 2018
  2. The website circuitpython.com did not exist at that point in time so its difficult to tell what the latest version of circuit python was.

Theory

I suspect that the library versions that are provided in the circuit python bundle are vastly different that the ones that the user is instructed to download

jan 12, 2023

Solution

  1. Document which versions of the library the user should install
  2. Update the instructions to work with the latest library

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