was completely working for a while

This commit is contained in:
Kónya Márton 2020-07-20 11:33:51 +02:00
parent 2b5d100b7e
commit 90e189ad06
1 changed files with 3 additions and 6 deletions

9
run.py
View File

@ -59,6 +59,8 @@ def l():
def post(title, body, subreddit): def post(title, body, subreddit):
try: try:
reddit.subreddit(subreddit).submit(title, selftext=body) reddit.subreddit(subreddit).submit(title, selftext=body)
print('The scheduled post has been posted!')
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
pass pass
except: except:
print(f'Something went wrong. Maybe you don\'t have permission to post in r/{subreddit}. Please press CTRL+C to close the script!') print(f'Something went wrong. Maybe you don\'t have permission to post in r/{subreddit}. Please press CTRL+C to close the script!')
@ -169,10 +171,5 @@ try:
time.sleep(2) time.sleep(2)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
# Not strictly necessary if daemonic mode is enabled but should be done if possible # Not strictly necessary if daemonic mode is enabled but should be done if possible
scheduler.shutdown() sched.shutdown()
# schedule.every().monday.at("17:12").do(uzenet)
# while True:
# schedule.run_pending()
# time.sleep(1)