how to write `SkypeApiException` in `try...except` statement?
Closed this issue · 1 comments
let's suppose that I've written bad login or pass to skype and the console gave me this output:
raise SkypeApiException(errMsg, resp)
skpy.core.SkypeApiException: ("That Microsoft account doesn't exist. Enter a different account or get a new one.", <Response [200]>)
Now I want to use this error type. If I need to use try...except
statement with this error posted above, what should I write? How to define this error so I can use it in the except
block?
When I write:
try:
#something
except skpy.core.SkypeApiException:
tk.messagebox.showerror("We can’t sign you!", "Your login or password is not correct. Try to fix it.")
... I get information that the skpy
is not defined. When I write except core.SkypeApiException
, then core
is seen as a name not defined. When I write except SkypeApiException
, then SkypeApiException
is not defined. So what should I write to be able to use this error in try...except
statement?
I want to use the error related to bad login/pass to create Tkinter error window. I can solve my problem when I will know how to write the name of this particular SkPy error. But all my trials are rejected by Spyder as not defined. The essence of the question isn't why I need try...except
statement.
When I write: [...
except skpy.core.SkypeApiException:
...] I get information that theskpy
is not defined.
Presumably because you haven't imported it.
When I write
except core.SkypeApiException
, thencore
is seen as a name not defined.
Again because you haven't imported it. However you've imported the Skype
class, you should import SkypeApiException
in the same way.
To reiterate, questions on basic Python usage such as imports do not belong here, and I expect a minimum amount of effort to be put into solving a problem, and for the problem to be specific to features of the library, not of Python in general, before it is asked about here.