Forums

PRAW script task, can't find bot1 in praw.ini

So, the error seems to be for this line, where "bot1" can't be found:

reddit = praw.Reddit('bot1')

In my praw.ini file, I have included:

[bot1]  
client_id=...  
client_secret=...  
password=...  
username=UCI-Help-Bot  
user_agent=UCI-Help-Bot 0.1

Running on local machine and through bash console works, but not through the scheduled tasks.
For importing gspread in spreadsheet.py, I have:

import sys  
sys.path.append('/home/jerrylshen/.local/lib/python3.6/site-packages/')  
import gspread

But praw.ini is in the same folder as the file that imports PRAW (reply_post.py)

Thanks

You don't need to add /home/jerrylshen/.local/lib/python3.6/site-packages/ to your sys.path -- it's on there automatically when you're using Python 3.7.

The problem with not finding bot1 is probably because the praw.ini file is being located relative to the working directory of your script, not the actual location where the .py file is stored. Try changing the command you're scheduling so that it cds into the appropriate directory before running it -- that is, instead of scheduling

/home/jerrylshen/something/your-script.py

...schedule this:

cd /home/jerrylshen/something && python3.6 your-script.py

Yup, changing the command solved this! thanks!

No problem :-)