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

NameError 'search results' not defined #29

Closed ahill1 closed 12 years ago

ahill1 commented 12 years ago

Example 1-11. I keep getting the following error. Can you please help???? Has anyone else received this error.

import networkx as nx import re g = nx.DiGraph()

all_tweets = [ tweet ... for page in search_results ... for tweet in page["results"] ] Traceback (most recent call last): File "", line 2, in NameError: name 'search_results' is not defined

ptwobrussell commented 12 years ago

The variable search_results was defined back in Example 1-4 (as the introductory chapter is laid out mostly as an interactive interpreter session, you have to follow along from beginning to end for Example 1-11 to make sense and work.)

That said, the chapter culminates with all of this wrapped up into a single script (referenced but not explicitly listed with source code in the print) that you can get at https://github.com/ptwobrussell/Mining-the-Social-Web/blob/master/python_code/introduction__retweet_visualization.py and run as a standalone script if you prefer.