Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Tutorial 1 error

The IO Pi Plus is a 32 channel MCP23017 GPIO expander for the Raspberry Pi

18/07/2015

Posted by:
giagara

giagara Avatar

Hello,
I'm approaching to IoPi by using tutorial1.py.
When i run command python tutorial1.py, this error is raised:
self._bus.write_byte_data(self.address, self.IOCON, self.config)AttributeError: 'NoneType' object has no attribute 'write_byte_data'
I didn't edit the library file, i've only run this command.
I use python 2.
Can you help me?
Many thanks
BR

18/07/2015

Posted by:
andrew

andrew Avatar

Hello

The error that you are getting could mean that the raspberry pi is having trouble communicating with the IO Pi using the I2C bus.

Have you followed our tutorial on setting up I2C on the Raspberry Pi? It may be worth going through the steps in the tutorial to check that everything is installed correctly.

Try running the command "i2cdetect -y 1". This will bring up a list of all I2C devices on the Raspberry Pi. The IO Pi should show up on channels 20 and 21.

21/10/2015

Posted by:
stevesilva

stevesilva Avatar

I'm sort of having the same issue. Actually tutorial1.py works perfect running python from the console.
However, when we use the same code from an apache webserver page (which is a python file) we also get the same error

self._bus.write_byte_data(self.address, self.IOCON, self.config)AttributeError: 'NoneType' object has no attribute 'write_byte_data'

'i2cdetect revealed that we can infact see the bus and that we can infact see the one card we have installed?
Any thoughts?

21/10/2015

Posted by:
andrew

andrew Avatar

It could be a permissions problem that is stopping apache from seeing the i2c bus. Have you tried adding apache to the i2c user group? If not you can do it using the following command.


sudo adduser www-data i2c


Once you have added apache to the group you will need to restart apache before running any python scripts.


sudo /etc/init.d/apache2 restart


Hopefully, this will fix your problem.

Sign in to post your reply


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.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout