Object has no attribute error

Hello fellow pi-top users! I the new owner of a pi-top 3. I know it is a pi 3 supported device (although I see that there is a post discussing pi 4 mods, which is super cool). I personally was super excited to get my hands on a device that will allow me to be dedicated to tinkering! Anyway, I am posting this because I want to understand where to go when I see errors such as the one below:

File “/home/pi/Documents/Python/potentiometer.py”, line 7, in
Traceback (most recent call last):
File “/home/pi/Documents/Python/potentiometer.py”, line 7, in
File “/usr/lib/python3/dist-packages/pitop/protoplus/adc.py”, line 23, in read_value
results = self.read_all()
File “/usr/lib/python3/dist-packages/pitop/protoplus/adc.py”, line 33, in read_all
results = self._device._read_data(self._channel_count)
AttributeError: ‘I2CDevice’ object has no attribute ‘_read_data’

my understanding is that the attribute .read_value is not available? or something to that effect and I’m trying to understand where I can go (i.e. the library) to understand what is available vs what is not. It’s important to me that I understand how to read the error and go to the source to troubleshoot it. Any advice on what might be going on here? I tried going to github to search for this attribute but could not find it. Thank you in advance for your assistance with this.

I’m trying to mess around with the potentiometer in the Inventor’s kit, for some context.

Hi @moose_boogle, you can try having a look here and here - these are the new github repos that should have everything you need.

You are right that this method doesn’t seem to exist - there must have been a refactoring that has caused the problem. Feel free to open a pull request to fix it, but in the meantime, I’ll inform the team of the problem - thanks for flagging it!

1 Like


So the proto+ library appears to use an internal method of the the common library’s I2C device object. We have fixed that here: https://github.com/pi-top/pi-top-Python-Common-Library/commit/dd2136b9e7538d8a46d8a15ec35c576b99e2aab7

A more thorough fix for this is described and tracked here: https://github.com/pi-top/pi-top-Python-Common-Library/issues/16

At any rate, the quick fix has gone out, so please do a system upgrade - hopefully that should resolve your issue!

1 Like

Thank you to both of you. The object appears to be available now and is working. Just an FYI on one other item I noticed:

The schematics for the ‘wub project’ on pi-topCODER appears to have the correct wiring configuration. As per that diagram below you get a valid result:

Now when you go to pi-top further, the schematics for the potentiomter hook up has the pin (middle pin from the potentiomter) going to the ground instead of the ADC slot. This means the diagram has the pin intended for ground on the potentiomter going to the ADC slot. This causes the computer to crash, understandably. Do I have this wrong? I read the diagram a few times to make sure I didn’t mix things up.