exception handling - Catch only some runtime errors in Python -


After

I am importing a module which underlies the following error in some circumstances: RuntimeError: requires pyparted root access < / P>

I know that I can check the root access only before import, but I would like to know how to catch the error of this special kind / except for the future reference. Is there any way to differentiate between this RuntimeError and others that can be picked up?

I know that I can only check root access before import, but I would like to know how to catch the mistake of this outbreak without any efforts for future reference? Is there a way to differentiate between this runtime year and others that can be picked up?

If an error occurs due to a particular situation, then I think the easiest way to catch the error is to test it, and you can increase yourself to a more specific error. Since all the 'error' is present before the error is thrown, in this case it is a problem with the environment.

I agree with the text that matches the error is a frightening possibility. / P>


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -