Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Python Help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Bazza
LXF regular


Joined: Sat Mar 21, 2009 11:16 am
Posts: 1473
Location: Loughborough

PostPosted: Sun Dec 04, 2011 2:24 pm    Post subject: Reply with quote

Not really studied the code except to say......

Check all of your single quotes as they look wrong they should be

Code:
"characters" or 'characters'

_________________
73...

Bazza, G0LCU...

Team AMIGA...
Back to top
View user's profile Send private message
evilnick
Moderator


Joined: Mon Apr 04, 2005 12:47 pm
Posts: 151
Location: LXF towers

PostPosted: Sat Jan 07, 2012 11:23 pm    Post subject: Reply with quote

The underscore characters you are using (I think just for effect) are unicode. You either need to define a unicode encoding at the top of the file or change them for something else like '-'. All the quotes look wrong, as has been mentioned.
also the if __name__ = '__main__' bit is the main executable code in the file, so it shouldn't be indented like that, you have it as part of the main() function, but actually it is the bit that invokes the main() function:
Code:

from django.utils.encoding import smart_str, smart_unicode
import twitter

CusKey = "XX"
CusSec = "XXX"
AccTokKey = "XXXX"
AccTokKeySec = "XXXXX"

def main():
   api = twitter.Api(consumer_key = CusKey, consumer_secret = CusSec, access_token_key = AccTokKey, access_token_secret = AccTokKeySec)
   timeline = api.GetFriendsTimeline()
   for status in timeline:
        print status.user.name.encode('ascii', 'ignore'), '----', status.text.encode('ascii', 'ignore')
       
if __name__ == '__main__':
         main()
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast