defining user exceptions

C

CSUIDL PROGRAMMEr

I am trying to write a user defined exception that will catch for
failed dependencies when a rpm is installed

try:
rpm -ivh xxx.rpm --force;
except RPMError:
print RPM failed dependency


Can some one tell me how to define this RPMError. I looked at python
docs but they were not useful.
 
D

Dennis Lee Bieber


That takes care of the literal question... But totally ignores that
the only things that are Python in the sample is the "try:" statement.

The "print" is close, since it needs quotes around the string.

But the "rpm..." call is not a Python statement, and will likely
generate something about a syntax error.

And, once the "rpm..." is embedded in an os.system() or subprocess.*
call, one has to parse the error messages produced by the external
program to determine if there is a failure...
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

defining, raising and catching exceptions 0
RPM error 1
those darn exceptions 13
Awsome Python - chained exceptions 41
Dealing with exceptions 19
python(abi) 1
dual python / bootstrap RPM woes 0
RPM error 0

Members online

Forum statistics

Threads
473,802
Messages
2,569,662
Members
45,433
Latest member
andrewartemow

Latest Threads

Top