Wie führe ich ein Python-Skript wie pm2 für nodejs aus?

Ich habe @ verwendpm2 für mein Node.js-Skript und ich liebe es.
Jetzt habe ich ein Python-Skript, das Streaming-Daten auf EC2 sammelt. Manchmal bombardiert das Skript und ich möchte, dass sich ein Prozessmanager wie pm2 neu startet.

Gibt es etwas, das mit pm2 für Python identisch ist? Ich habe gesucht und konnte nichts finden.

Hier ist mein Fehler

  File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 430, in filter
    self._start(async)
  File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 346, in _start
    self._run()
  File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 286, in _run
    raise exception
AttributeError: 'NoneType' object has no attribute 'strip'
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90:

Es ist ein einfaches Datenerfassungsskript

class StdOutListener(StreamListener):

    def on_data(self, data):
        mydata = json.loads(data)
        db.raw_tweets.insert_one(mydata)
        return True

    def on_error(self, status):
        mydata = json.loads(status)
        db.error_tweets.insert_one(mydata)


if __name__ == '__main__':

    #This handles Twitter authetification and the connection to Twitter Streaming API
    l = StdOutListener()
    auth = OAuthHandler(consumer_key, consumer_secret)
    auth.set_access_token(access_token, access_token_secret)
    stream = Stream(auth, l)

    #This line filter Twitter Streams to capture data by the keywords: 'python', 'javascript', 'ruby'
    stream.filter(follow=[''])

Das möchte ich, dass es sich einfach von selbst neu startet, falls etwas passiert.

Antworten auf die Frage(10)

Ihre Antwort auf die Frage