我有一個簡單的Python腳本發送Gearman的任務:蟒蛇 - Gearman的 - 不斷得到類型錯誤
客戶:
# "source" is a simple tuple
client = GearmanClient(['localhost'])
client.submit_job('queue_feed', simplejson.dumps(source))
服務器:
def queue_feed(work, job):
source = simplejson.loads(job.data)
print source
if __name__ == '__main__':
if len(sys.argv) > 1:
if sys.argv[1] == "spawn":
worker = GearmanWorker(['localhost'])
#nohup python /home/padsquad/apps/gearman_articles.py spawn &
worker.register_task('queue_feed', queue_feed)
print 'working...'
worker.work()
我不知道我是什麼在這裏做錯了,齒輪工服務器不斷給我以下錯誤:
TypeError: Expecting byte string, got <type 'NoneType'>
你可以發佈完整的追溯,所以我們可以知道你的錯誤是哪一行? – mgilson