I have already pip install twitter like you suggested however now i encounter another problem.
root@GroveNoise:~/GrovePi/Projects/Sensor Twitter Feed# python wifi_twit.py
Traceback (most recent call last):
File “wifi_twit.py”, line 12, in <module>
import grovepi
File “/usr/local/lib/python2.7/dist-packages/grovepi-0.0.0-py2.7.egg/grovepi.py”, line 24, in <module>
bus = smbus.SMBus(0)
IOError: [Errno 2] No such file or directory
I have done apt-get update and upgrade.
Another issue that i faced was with the firmware update, i tried once it was fine but the second time it was giving me error such asroot@GroveNoise:~/GrovePi/Firmware# ./firmware_update.sh
Updating the GrovePi firmware
Do you want to update the firmware? [y,n]y
Make sure that GrovePi is connected to Raspberry Pi./firmware_update.sh: line 12: [: ./grove_pi_firmware.hex: unary operator expected
Firmware not found
Check if firmware is there or run again
Press any key to exit
Hey,
For the IO error, update bus = smbus.SMBus(0) on line 24 to bus = smbus.SMBus(1). This should allow the Pi to access the I2C lines on the latest revision of the Pi.
Now for the firmware error, make sure that you have the latest version of the GrovePi Github repository and run the script as root sudo # ./firmware_update.sh.
The same error is ‘module’ object has no attribute ‘Api’ but after the I change it to ‘api’ same error appear ‘module’ object not callable. I have install twitter and install twitter library, firmware is updated but still same issue appear. You can refer to the attachment.
Another question, i tried to run the project without uploading it to twitter, it works fine but i am not able to quit the python script i tried to add in codes such as ‘except KeyboardInterrupt’ but it still i am unable to quit the script.
“For the IO error, update bus = smbus.SMBus(0) on line 24 to bus = smbus.SMBus(1). This should allow the Pi to access the I2C lines on the latest revision of the Pi.”
I could not find that line. when i go into the python file (wifi-twit.py) there is nothing on line 24. Where exactly should i go to make the necessary changes. if you dont mind can you please explain to me how this error occur? before this the python script runs normally, i did not modify anything else i also did not shutdown the system but the next time i tried to run this error appear.
Hey,
I am not exactly sure what changed on your system but what this error says is that you are trying to use the wrong I2C bus. The Raspberry Pi has 2 I2C buses, and we are using I2C bus 1.
First try running setup.py in the Software/Python folder: sudo python setup.py install. That would reinstall the library.
Try that out and if that does not work out, we’ll help you edit it.
This error statement TypeError: ‘module’ object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happend because the module name and class name have the same name .
If you have a class “MyClass” in a file called “MyClass.py” , then you should import :
from MyClass import MyClass
In Python , a script is a module, whose name is determined by the filename . So when you start out your file MyClass.py with import MyClass you are creating a loop in the module structure.