Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have GeekTool for Lion and am trying to run the Glet located at - http://www.macosxtips.co.uk/geeklets/messaging/latest-tweet-1/

On my system. It's just not working. The same code is running perfect in terminal and IDLE, but GeekTool is not processing it. I thought it might be a problem with Geektool and Python, but another python script, used to pull the latest XKCD is working perfect on GeekTool (http://code.google.com/p/geektool-xkcd/source/browse/trunk/xkcd.py)

I thought it must be a problem with indentation etc but that's not the case. I've brought the code down to the following, it works in terminal but not with Geektool -

#!/usr/bin/env python
import tweepy

CONSUMER_KEY = '...'
CONSUMER_SECRET = '...'
ACCESS_KEY = '...'
ACCESS_SECRET = '...'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

tested = api.home_timeline()
for result in tested:
    print result.text + '\n' + '\n- ' + result.user.screen_name
    break

I'm not sure at all what the issue is. How do I know that the code is not working? I added the Display Status feedback message icon on the GLet. It keeps glowing red (while the XKCD one is green). If I change the command in the same GLet to something simple like - echo "hello" or python -c print "Hello" then it works fine (glows green, shows output) but as soon as I change it back to the old one, problem!

Also, another doubt - the python -c print command doesn't print anything in the terminal. What's the issue with that? Can someone else please run it and tell me how to print in terminal using python?

share|improve this question
    
Post the command of how you are calling the script in geektool, and is that the entire script? It looks like part of it is missing. –  l'L'l Oct 17 '11 at 9:12
    
This is the full script. I modified the original one and put this up. It works in terminal. To call it from Geektool, I simply added a command gooklet from GeekTool 3 (the MacAppStore version) and gave it the command - python /Users/<my_user_name>/Documents/GeekTweep.py (that's what I call the python file). Another file in the same directory is called the same way, runs the XKCD script and is working. –  Nitin Khanna Oct 17 '11 at 22:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.