About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

write_pin error

431 Views - Created 10/08/2020

10/08/2020

Posted by:
oblenga

Users Avatar

Hello. When this program runs I get the next error

io.write_pin(1,1)
  File "/usr/local/lib/python3.7/dist-packages/ExpanderPi/ExpanderPi.py", line 702, in write_pin
    self.__set_pin(pin, value, self.GPIOA, self.GPIOB)
  File "/usr/local/lib/python3.7/dist-packages/ExpanderPi/ExpanderPi.py", line 440, in __set_pin
    newval = self.__updatebyte(curval, pin, value)
AttributeError: 'IO' object has no attribute '_IO__updatebyte'

This error only occurs with this sentence: "write_pin",  not with "read_pin" or "write_port"  for example.

I think the Library instalation is correct because there is not error in "import ExpanderPi" and "set_port_direction"

Someone knows what the solution is?

Thanks

This is the code... 

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os, time, sys, glob
import ExpanderPi

io = ExpanderPi.IO()

io.set_port_direction(0, 0x00) 
io.set_port_direction(1, 0x00) 
io.set_port_pullups(0, 1)  
io.set_port_pullups(1, 1) 

print("Hello")

io.write_pin(0,1)
time.sleep(3)
io.write_pin(0,0)

 

10/08/2020

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

Hello

Sorry there was a bug with the Expander Pi python library.  Please can you download the updated version from our GitHub repository and see if that fixes your problem?

AB Electronics UK Tech Support

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.