esdalmaijer / markovbot

Library to generate text with a Markov chain, with support to read and post updates to Twitter accounts.

Home Page:http://www.pygaze.org/2016/03/how-to-code-twitter-bot/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

markovbot crash with "MSG frException in thread auto tweeter"

emilioxavier opened this issue · comments

Hi @esdalmaijer
First, thank you for a great bot!

Every few days markovbot crashes with the following error:

MSG frException in thread autotweeter:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/emilioxavier/markovbot/markovbot27.py", line 1221, in _autotweet
    self._error(u'_autotweet', u"Failed to post a tweet! Error: '%s'" % (e))
  File "/home/emilioxavier/markovbot/markovbot27.py", line 1384, in _error
    raise Exception(u"ERROR in Markovbot.%s: %s" % (methodname, msg))
Exception: ERROR in Markovbot._autotweet: Failed to post a tweet! Error: 'Twitter sent status 403 for URL: 1.1/statuses/update.json using parameters: (oauth_consumer_key=REMOVED&oauth_nonce=REMOVED&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1513398340&oauth_token=REMOVED&oauth_version=1.0&status=Using%20MD%20simulation%20was%20used%20for%20learning.%20Results%20show%20how%20the%20intersection%20between%20two%20vertices%20of%20%CE%93.%20&oauth_signature=REMOVED)
details: {u'errors': [{u'message': u'Status is a duplicate.', u'code': 187}]}'

Any ideas what might be causing the error and crash? Does the error mean markovbot cannot reach the internet? The bot is running on a RaspberryPi (Linux hindbaer 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux) and connects to the internet over wifi. Please let me know if you need more information.

Thank you for your help!
Emilio

Hi Emilio,

Thanks for the compliment!

Your error means that the bot tried to post a tweet that had the exact same content as one of its earlier tweets. If you're using the functions that auto-generate tweets based on a Markov chain, this could reflect having too little source material to create unique content. (The fewer source materials, the higher the chances of a particular combination of words occurring in the same order.)

Cheers,
Edwin

Hi Edwin
Thank you for the explanation! A short list of keywords was causing the error.

Emilio