Instapy: How to auto-restart after crashing

Created on 23 Jul 2018  路  6Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

If any error accrued restart job()

wontfix

Most helpful comment

@HCWcoder No. Simply use this script, this restart your script forever if it fails. Change the name of script.py with your file, then execute this script instead.

All 6 comments

@HCWcoder I use this:

#!/usr/bin/env python3
# coding: utf-8
from subprocess import Popen

filename = 'script.py'
while True:
    print("Starting " + filename)
    p = Popen("python3 " + filename, shell=True)
    p.wait()

@marcomokastyle

where should i put these ?

    except KeyboardInterrupt:
        session.end()
    except WebDriverException:
        pass
    except:
        import traceback
        print(traceback.format_exc())
job()


while True:
    schedule.run_pending()
    time.sleep(1)

can you paste it inside my code ?

@HCWcoder No. Simply use this script, this restart your script forever if it fails. Change the name of script.py with your file, then execute this script instead.

@marcomokastyle oh :D thanks so muchh !!

@marcomokastyle how can i use this script in case im using this bot using env? instead of local pythin3 or python2. im using env on python2 to run this but after some time it stop so i want to use your script

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. > If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rahulkapoor90 picture rahulkapoor90  路  3Comments

ingorichter picture ingorichter  路  3Comments

CodeMaster1 picture CodeMaster1  路  3Comments

46960 picture 46960  路  3Comments

converge picture converge  路  3Comments