mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

piface twitter chicken

Sat Jan 26, 2013 2:32 pm

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.

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: piface twitter chicken

Sat Jan 26, 2013 3:05 pm

I've no idea how to solve this but couldn't ignore a post entitled "piface twitter chicken" :)

Classic!
Apple say... Monkey do !!

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: piface twitter chicken

Sat Jan 26, 2013 5:59 pm

Seeing the full error message might help...?
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Sat Jan 26, 2013 8:32 pm

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

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: piface twitter chicken

Sun Jan 27, 2013 2:12 pm

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.
Apple say... Monkey do !!

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: piface twitter chicken

Sun Jan 27, 2013 3:58 pm

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'

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Sat Feb 02, 2013 8:53 pm

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'

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: piface twitter chicken

Mon Feb 04, 2013 11:35 am

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'

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Mon Feb 04, 2013 4:02 pm

Hi no its called twitter_user.py it's one of the demo scripts with the pi face add on

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Mon Feb 04, 2013 4:14 pm


-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: piface twitter chicken

Mon Feb 04, 2013 4:59 pm

Nothing obvious sticks out... :?
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

User avatar
davef21370
Posts: 897
Joined: Fri Sep 21, 2012 4:13 pm
Location: Earth But Not Grounded

Re: piface twitter chicken

Mon Feb 04, 2013 6:41 pm

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.
Apple say... Monkey do !!

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Mon Feb 04, 2013 7:14 pm

Many thanks there is a api.py in twitter folder is that the one?

User avatar
tonyhughes
Posts: 951
Joined: Wed Dec 26, 2012 3:46 am

Re: piface twitter chicken

Mon Feb 04, 2013 7:15 pm

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.

mypifi
Posts: 131
Joined: Sun Oct 21, 2012 1:28 pm
Location: oxford
Contact: Website

Re: piface twitter chicken

Mon Feb 11, 2013 12:20 am

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

Return to “Python”