Search code examples
pythonpraw

How do I import InvalidURL exception in praw for python?


I'm not able to import InvalidURL exception like this:

from praw.exceptions import ClientException, InvalidURL

ClientException exists, but InvalidURL doesn't for some reason.

The exception is there in the documentation and github repo.


Solution

  • According to the git blame, the InvalidURL class was added to the codebase about 6 months ago. As @DeepSpace suggests, upgrading praw to the latest release using pip install -U praw should do the trick. (Please note that -U is the same as --upgrade.)