hi there
i have a piface and have tried unsucessfully to get the twitter chicken demo working. i have downloaded the twitter api s andworks in terminal but when i try and run the twitter_chicken it comes up with an error in line 21 twitter.Api anyone know why and how to solve this?
many thanks in advance.
- davef21370
- Posts: 897
- Joined: Fri Sep 21, 2012 4:13 pm
- Location: Earth But Not Grounded
Re: piface twitter chicken
I've no idea how to solve this but couldn't ignore a post entitled "piface twitter chicken" 
Classic!

Classic!
Apple say... Monkey do !!
Re: piface twitter chicken
Seeing the full error message might help...?
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Re: piface twitter chicken
the error is as follows:
Traceback (most recent call last):
File "./twitter_listen.py", line 50 in <module>
main()
File "./twitter_listen.py", line 21, in main
api = twitter()
Typeerror: "module" object is not callable
Traceback (most recent call last):
File "./twitter_listen.py", line 50 in <module>
main()
File "./twitter_listen.py", line 21, in main
api = twitter()
Typeerror: "module" object is not callable
- davef21370
- Posts: 897
- Joined: Fri Sep 21, 2012 4:13 pm
- Location: Earth But Not Grounded
Re: piface twitter chicken
Is "twitter" the module? As in...
...at the top of your script.
If so you can't say api=twitter as twitter is the module, not a class. It would need to be api=twitter.something
I may be very wrong but let us know how you get on.
Cheers.
Dave.
Code: Select all
import twitter
If so you can't say api=twitter as twitter is the module, not a class. It would need to be api=twitter.something
I may be very wrong but let us know how you get on.
Cheers.
Dave.
Apple say... Monkey do !!
Re: piface twitter chicken
If it's this library: http://code.google.com/p/python-twitter/ , it should be:
Code: Select all
import twitter
...
api = twitter.Api()
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Re: piface twitter chicken
Hi thanks for the help the error is still the same apart from the last line which reads:
AttributeError: 'module' object has no attribute 'Api'
AttributeError: 'module' object has no attribute 'Api'
Re: piface twitter chicken
Hmm, did you too fall into the naming trap: is your own script named twitter.py? If so, it obscures the 'module twitter' from the library - the interpreter thinks your script is 'module twitter'... rename your script (in typical tutorial way, maybe 'mytwitter.py') and it works...
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Re: piface twitter chicken
Hi no its called twitter_user.py it's one of the demo scripts with the pi face add on
Re: piface twitter chicken
Nothing obvious sticks out... 

http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
- davef21370
- Posts: 897
- Joined: Fri Sep 21, 2012 4:13 pm
- Location: Earth But Not Grounded
Re: piface twitter chicken
Code looks fine, just been here http://code.google.com/p/python-twitter/ and everything matches what you're doing.
I'd try opening the twitter module and looking for the Api class, if it's there your code should work, if it isn't then assume dark forces are at work and re-install the module.
I'd try opening the twitter module and looking for the Api class, if it's there your code should work, if it isn't then assume dark forces are at work and re-install the module.
Apple say... Monkey do !!
Re: piface twitter chicken
Many thanks there is a api.py in twitter folder is that the one?
- tonyhughes
- Posts: 951
- Joined: Wed Dec 26, 2012 3:46 am
Re: piface twitter chicken
Sorry to hear that.smstext wrote: i have a piface
I went to the nightclub last week, and there were some dogfaces. So you are not alone out there.
Re: piface twitter chicken
Decided today to reflash the card with the image for piface and re download twitter and try again, now it works and I have done a quick write up with a video http://smstextblog.blogspot.co.uk/2013/ ... t.html?m=1