- def __call__(self, twitter, options):
- if (not options['extra_args'][0]):
- raise TwitterError("You need to specify a User (Screen Name)")
- af = get_admin_formatter(options)
- user = self.getUser(twitter, options['extra_args'][0])
- if(user):
- print af(options['action'], user).encode(sys.stdout.encoding, 'replace')
-
+ def __call__(self, twitter, options):
+ if not options['extra_args'][0]:
+ raise TwitterError("You need to specify a user (screen name)")
+ af = get_admin_formatter(options)
+ try:
+ user = self.getUser(twitter, options['extra_args'][0])
+ except TwitterError, e:
+ print "There was a problem following or leaving the specified user."
+ print " You may be trying to follow a user you are already following;"
+ print " Leaving a user you are not currently following;"
+ print " Or the user may not exist."
+ print " Sorry."
+ print
+ print e
+ else:
+ print af(options['action'], user).encode(sys.stdout.encoding, 'replace')
+