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

Query RE: IndexError: list index out of range #26

Closed sp00 closed 11 years ago

sp00 commented 12 years ago

Hi

Firstly, just wanted to say how fantastic the book is - and this git is just what I was looking for..

I'm learning Python as I'm going - and following all the tutorials I can. But I've hit a stumbling block, I keep getting the following message on friends_followers__get_friends.py (or other friends_followers files)

Traceback (most recent call last): File "", line 1, in File "friends_followers__get_friends.py", line 9, in SCREEN_NAME = sys.argv[1] IndexError: list index out of range

I've edited the twitter__login.py file using my consumer secret / key but having found about the SCREEN_NAME

Hoping you can help

Thanks

Lee

ptwobrussell commented 12 years ago

SCREEN_NAME is a variable that gets defined by reading a command line argument from the script that you are executing. Try searching for "python sys.argv" and you should find some useful documentation on how this is used. In practice, you'll need to execute the script in a terminal and pass in an argument for it to pick up that value, or you'll need to modify the script to say something like SCREEN_NAME='foo' if you want to run it some other way. Please let me know if this helps.

sp00 commented 12 years ago

ah ok - thank you so much

:)

ptwobrussell commented 11 years ago

I think we resolved this issue but never closed it, so I'll go ahead and close it now as part of some housekeeping.