These are chat archives for praw-dev/praw

8th
Mar 2017
Bryce Boe
@bboe
Mar 08 2017 05:22
@Lil-Jening what do you mean?
Lil-Jening
@Lil-Jening
Mar 08 2017 15:28

Currently I've got this set in my code
try: print('Submitting {}...'.format(title)) subm = r.subreddit(SUBREDDIT_NAME).submit(title, url=link,resubmit=False) except praw.exceptions.APIException: print("Error")
I would love to get more in depth with the exceptions but I am unable to get exceptions working.

I know that reddit returns some errors like ALREADY_SUB and more can be found here https://github.com/reddit/reddit/blob/master/r2/r2/lib/errors.py.

This is code ive tried.
except praw.exceptions.APIException(ALREADY_SUB,' that link has already been submitted','url'): print("That link is already submitted")

Have also tried
except praw.exceptions.APIException('ALREADY_SUB',' that link has already been submitted','url'):

I am also struggling how to send a private message via the script. Could you help me with that as well. I am using PRAW 4.4.0.
Bryce Boe
@bboe
Mar 08 2017 15:40
For the exception handling part, I suggest taking your question to /r/learnpython as I think you're missing a piece of it.
Examples in the docs.
@Lil-Jening ^
Lil-Jening
@Lil-Jening
Mar 08 2017 20:48
Oh thanks! I thought it was under Models message. but its under redditor xD. Also got the except figured out. Thanks for the help!