pyspider-stock icon indicating copy to clipboard operation
pyspider-stock copied to clipboard

最后一步做情感分析的时候pymongo报错

Open linkerlin opened this issue 7 years ago • 2 comments

$ python main.py Traceback (most recent call last): File "main.py", line 42, in aggregateFactor.aggregate(stockCode, grab_time) File "/Users/linkerlin/gits/pyspider-stock/east_sentiment/aggregateFactor.py", line 22, in aggregate for result in documents['result']: TypeError: 'CommandCursor' object has no attribute 'getitem'

linkerlin avatar May 27 '17 06:05 linkerlin

    coll2 = db[date+'SentimentFactor']
    for result in documents['result']:
        coll2.insert_one({
            "sentiment_factor": result['sentiment_factor'],
            "last_date": date
        })

问题出在for 这一行。 documents[]的写法貌似不对

linkerlin avatar May 27 '17 06:05 linkerlin

pymongo因为一些原因暂时不要用高版本的,如果没记错的话用<=2.0版本的,这个我后面修复下

ryh95 avatar May 27 '17 06:05 ryh95