ptwobrussell / Mining-the-Social-Web

The official online compendium for Mining the Social Web (O'Reilly, 2011)
http://bit.ly/135dHfs
Other
1.21k stars 491 forks source link

Example 5-4 not working with databases produced by Example 5-14 #34

Closed njmccracken closed 11 years ago

njmccracken commented 11 years ago

I have produced a database in couchdb using the_tweet__search.py as in Example 5-14. Now I want to run the_tweet__count_entities_in_tweets.py, from Example 5-4. This is suggested in the book on page 148. Here is the error that I get:

$ python the_tweetcount_entities_in_tweets_from_search.py search-xkcd Traceback (most recent call last): File "the_tweetcount_entities_in_tweets_from_search.py", line 83, in db.view('index/entity_count_by_doc', group=True)], File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/client.py", line 984, in iter File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/client.py", line 1003, in rows File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/client.py", line 990, in _fetch File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/client.py", line 880, in _exec File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 393, in get_json File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 374, in get File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 419, in _request File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 239, in request File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/http.py", line 205, in _try_request_with_retries socket.error: 54

The CouchDB server is running and in Futon, I can view the database "search-xkcd" after the error. The _design/index document is present. The view index/entity_count_by_doc is present, but is empty.

I read the debug suggestions given to other users and tried to execute the count entities program in a python terminal one piece at a time. When I get to the view definition, I get:

view = ViewDefinition('index', 'entity_count_by_doc', entityCountMapper, ... reduce_fun=summingReducer, language='python') Traceback (most recent call last): File "", line 2, in File "/Library/Python/2.6/site-packages/CouchDB-0.8-py2.6.egg/couchdb/design.py", line 93, in init File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 694, in getsource lines, lnum = getsourcelines(object) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 683, in getsourcelines lines, lnum = findsource(object) File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/inspect.py", line 531, in findsource raise IOError('could not get source code') IOError: could not get source code

Is there something different about the databases produced by the_tweet__search.py from the ones harvested from the user timeline? I have several of those and can run the count entities program on those without problem.

Thank you. njmccracken

njmccracken commented 11 years ago

Among the many things that I tried, I observed that making a new database with the search program would also have these empty views and that accessing the views also gave errors in Futon. I finally restarted the server and deleted the databases with corrupted views. Now I am able to make databases using the search program (5-14) and also run the count entities program that makes the views (5-4) with no problem. Perhaps this is flaky behavior on the part of the couchdb.