作成済みtwitterアプリケーションgoogleアプリケーションエンジンこのアプリケーションを実行中にこのリポジトリhttps://github.com/cybermithun/twitter-search-reply-botを使用すると、このエラーが発生します。誰もがいただきましたコードGoogle App EngineでPythonアプリケーションエラーが発生しました
Internal Server Error
The server has either erred or is incapable of performing the requested operation.
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/s~leoapp109/1.391952730855998659/main.py", line 32, in get
lastTweet = db.GqlQuery("SELECT * FROM LastTweet").fetch(1)[0]
IndexError: list index out of range
これで間違って私に言うことができる
#!/usr/bin/env python
#**strong text**
# Copyright 2007 Google Inc.
import datetime
from google.appengine.ext import db
import webapp2
import time
import sys
import random
from twython import Twython, TwythonError
from google.appengine.ext import db
class LastTweet(db.Model):
tweetId = db.StringProperty()
class MainHandler(webapp2.RequestHandler):
def get(self):
idnum = 0
lastTweet = db.GqlQuery("SELECT * FROM LastTweet").fetch(1)[0]
# try:
# lastTweet = LastTweet.all()
# except:
# lastTweet = None
# if lastTweet != None:
# idnum = lastTweet.tweetId
# else:
# idnum = "0"
apiKey = 'QQQ'
apiSecret = 'QQQ'
accessToken = 'QQQ'
accessTokenSecret = 'QQQ'
twitter = Twython(apiKey,apiSecret,accessToken,accessTokenSecret)
message = "Hi, if you Love Wine you will Love to Wear this Wine T-Shirt www.teespring.com/WineT"
search_results = twitter.search(q="#Winelover", since_id = idnum, count=20)
print(search_results)
for tweet in search_results["statuses"]:
screenname = "@" + tweet["user"]["screen_name"]+" ";
print tweet["id_str"]
try:
#self.response.write('Hello world!')
twitter.update_status(status=screenname + message, in_reply_to_status_id=tweet["id_str"])
except TwythonError:
pass
idnum = tweet["id_str"]
print(idnum)
if search_results:
lastTweet.tweetId = idnum
lastTweet.put()
# self.response.write('Hello world!')
app = webapp2.WSGIApplication([
('/', MainHandler)
], debug=True)
トレースバックをフォーマットできますか?あなたの投稿を編集し、トレースバックを選択し、コードブレースをクリックします。 – snakecharmerb
フェッチが空のコンテナを返すように見えます。 – cdarke