tommeagher / heroku_ebooks

An archive of a script to generate Markov chains and to post to an _ebooks account on Twitter using Heroku. No longer actively supported.
264 stars 163 forks source link

IndexError: list index out of range #49

Closed harveywells closed 6 years ago

harveywells commented 6 years ago

Hello! When trying to use Twitter source accounts with at least 3600K Tweets in local_settings.py I receive the following error:

1713 tweets found in JoseCanseco Traceback (most recent call last): File "ebooks.py", line 199, in ebook_status = mine.generate_sentence() File "/app/markov.py", line 55, in generate_sentence restup = (res[-2], res[-1]) IndexError: list index out of range

The JoseCanseco Twitter account specified in the stack trace has over 11K tweets. Any suggestions on how to proceed?

tommeagher commented 6 years ago

You have two separate issues happening here. The number of tweets found is correct. This script only grabs that last 3,600, which are all that are available under the Twitter API. It then discards any Retweets or quote tweets. So that would leave about 1,713 for the script to work with. That seems fine.

The IndexError is a little more concerning, but I'm not able to reproduce it. I'm pulling from the same source account and it's generating tweets just fine. Are you getting the error message consistently or just every so often?

harveywells commented 6 years ago

Thanks for the response @tommeagher! I tried different Twitter accounts and it worked as expected. I plugged my original sources back in and it generated tweets as expected 🤷‍♀️

tommeagher commented 6 years ago

OK, @harveywells. Thanks for following up. I'll close this for now. If it comes up again, just holler and we can try to investigate.