Page 1 of 1

piface twitter chicken

Posted: Sat Jan 26, 2013 2:32 pm
by mypifi
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.

Re: piface twitter chicken

Posted: Sat Jan 26, 2013 3:05 pm
by davef21370
I've no idea how to solve this but couldn't ignore a post entitled "piface twitter chicken" :)

Classic!

Re: piface twitter chicken

Posted: Sat Jan 26, 2013 5:59 pm
by -rst-
Seeing the full error message might help...?

Re: piface twitter chicken

Posted: Sat Jan 26, 2013 8:32 pm
by mypifi
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

Re: piface twitter chicken

Posted: Sun Jan 27, 2013 2:12 pm
by davef21370
Is "twitter" the module? As in...

Code: Select all

import twitter
...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.

Re: piface twitter chicken

Posted: Sun Jan 27, 2013 3:58 pm
by -rst-
If it's this library: http://code.google.com/p/python-twitter/ , it should be:

Code: Select all

import twitter
...
api = twitter.Api()

Re: piface twitter chicken

Posted: Sat Feb 02, 2013 8:53 pm
by mypifi
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'

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 11:35 am
by -rst-
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...

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 4:02 pm
by mypifi
Hi no its called twitter_user.py it's one of the demo scripts with the pi face add on

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 4:14 pm
by mypifi

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 4:59 pm
by -rst-
Nothing obvious sticks out... :?

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 6:41 pm
by davef21370
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.

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 7:14 pm
by mypifi
Many thanks there is a api.py in twitter folder is that the one?

Re: piface twitter chicken

Posted: Mon Feb 04, 2013 7:15 pm
by tonyhughes
smstext wrote: i have a piface
Sorry to hear that.

I went to the nightclub last week, and there were some dogfaces. So you are not alone out there.

Re: piface twitter chicken

Posted: Mon Feb 11, 2013 12:20 am
by mypifi
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