I have no problem running my app on localhost, but when I deploy it I
receive this error:


2011-08-24 16:55:57.464 Traceback (most recent call last):
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/web/application.py", line
237, in process
E 2011-08-24 16:55:57.464 return self.handle()
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/web/application.py", line
228, in handle
E 2011-08-24 16:55:57.464 return self._delegate(fn, self.fvars, args)
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/web/application.py", line
409, in _delegate
E 2011-08-24 16:55:57.464 return handle_class(cls)
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/web/application.py", line
385, in handle_class
E 2011-08-24 16:55:57.464 return tocall(*args)
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/brittanyberman.py", line
18, in GET
E 2011-08-24 16:55:57.464 tweets = brittanytweets.getTweets()
E 2011-08-24 16:55:57.464 File "/base/data/home/apps/
s~brittanybermantweets/1.352785960472444569/brittanytweets.py", line
16, in getTweets
E 2011-08-24 16:55:57.464 tweets = json.loads(rawtweets)
E 2011-08-24 16:55:57.464 UnboundLocalError: local variable
'rawtweets' referenced before assignment


To make matters more confusing, it worked fine when I deployed it last
night.

Here is the python in question:

import urllib2
import simplejson as json

url = "http://api.twitter.com/1/statuses/user_timeline.json?
screen_name=brittanyberman"


def getTweets():
        try:
                rawtweets = urllib2.urlopen(url).read()
        except urllib2.HTTPError, e:
                print "HTTP error: %d" % e.code
        except urllib2.URLError, e:
                print "Network error: %s" % e.reason.args[1]

        alltweets=[]
        tweets = json.loads(rawtweets)

        for i in range(12):
                alltweets.append(tweets[i]['text'])

        #strip out the 'u' char
        for i in range(len(alltweets)):
                alltweets[i]=str(alltweets[i])

        return alltweets


The script runs fine on a local shell. Any idea what's wrong?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to