user3044343
user3044343

Reputation: 1

How do I get this Python script to execute at the certain time?

I would like to get the script to execute at a certain time and date.

import praw

r = praw.Reddit(user_agent="UA goes here")
r.login("username", "password")
sub = r.get_subreddit("Subreddit name goes here")
sub.submit("Title goes here", text="Post text goes here")

I'm trying to create an auoposting thread bot for my subreddit. This single task of getting this script to run and execute properly has been a pain in the butt. I've tried opening the .py file with task scheduler, but sadly i've had no luck. Everyone i've asked has told me that I have to get familiar and pretty much learn python fully. I don't want to take 3 weeks to learn python, I want to autopost threads to my subreddit.

Upvotes: 0

Views: 295

Answers (1)

Pi Marillion
Pi Marillion

Reputation: 4674

Set up a Windows scheduled task. To cause the python routine to execute and then leave the window open so it's output can be seen by the user, use this as the task run:

cmd.exe /k "python C:/path/to/script.py"

/k causes the window to stay open.

Upvotes: 1

Related Questions