#๐Ÿ”’ How do I make exceptions with this library?

20 messages ยท Page 1 of 1 (latest)

frank moat
violet groveBOT
#

@frank moat

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

spark imp
#

What exactly have you tried, and how are you importing the package?

potent basin
#

import or call the expections you want,
exceptiongithub.GithubException.GithubException(status

#

bad copypasta sec

frank moat
potent basin
#

github.GithubException.GithubException

frank moat
#

My brain is not braining aha.

potent basin
#

from github.GithubException.GithubException import BadCredentialsException

frank moat
potent basin
#

except BadCredentialsException as e:
do something

#

I suppose you could, depends on how your importing github already.. but you would still have to except on each one you want to use..
like if you import github you could just call each except directly like yhe import statement..

#

except github.GithubException.GithubException.BadCredentialsException

#

better to just pull all out you want to reference onetime to make it more readable,

#

from github.GithubException.GithubException import BadCredentialsException,BadAttributeException, etc

frank moat
#

Okay, I understand, thank you for your help!

#

!close

violet groveBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.