Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

TypeError: __init__() got an unexpected keyword argument 'busnum' #9

Closed
simonwhitaker opened this issue Nov 23, 2014 · 4 comments
Closed

Comments

@simonwhitaker
Copy link

The instructions at https://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi/usage no longer work. It appears that this change is the cause. Running the char_lcd_plate.py example script (or any other attempt to use Adafruit_CharLCDPlate now gives an error:

$ sudo ./examples/char_lcd_plate.py 
Traceback (most recent call last):
  File "./examples/char_lcd_plate.py", line 10, in <module>
    lcd = LCD.Adafruit_CharLCDPlate()
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_CharLCD-1.0.0-py2.7.egg/Adafruit_CharLCD/Adafruit_CharLCD.py", line 434, in __init__
    self._mcp = MCP.MCP23017(address=address, busnum=busnum)
  File "/usr/local/lib/python2.7/dist-packages/Adafruit_GPIO-0.6.5-py2.7.egg/Adafruit_GPIO/MCP230xx.py", line 154, in __init__
    super(MCP23017, self).__init__(address, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'busnum'
@simonwhitaker
Copy link
Author

If you're here looking for a workaround, this worked for me:

git clone git@github.com:adafruit/Adafruit_Python_GPIO.git
cd Adafruit_Python_GPIO
git checkout be1d242
sudo python setup.py install

This installs the GPIO library as it was at commit be1d242, before the breaking change.

@tdicola
Copy link
Contributor

tdicola commented Nov 23, 2014

Oh thanks for catching that and sorry it broke the MCP23017 code used there. Let me take a look and submit a fix.

@tdicola
Copy link
Contributor

tdicola commented Nov 23, 2014

Looks like I missed the kwargs parameter when making those changes. Just submitted a fix that makes it compile again. Can you give it a shot to confirm too? You might need to download the python GPIO library again and force it to reinstall with:

sudo python setup.py install --force

@simonwhitaker
Copy link
Author

👍 Works like a charm. Thanks @tdicola!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants