Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
linkerlin opened this issue May 27, 2017 · 2 comments
Open

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

linkerlin opened this issue May 27, 2017 · 2 comments

Comments

@linkerlin
Copy link

$ 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
Copy link
Author

linkerlin commented May 27, 2017

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

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

@ryh95
Copy link
Owner

ryh95 commented May 27, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants