I am writing a script that is a wrapper for a number of other utilities often found on *nix workstations, including the rar and par2 utilities. I want the script to check whether those utilities are installed at the outset (and not when they are needed later on in the script, which I suppose I could just use exception handling to do). Here's what I have now:
import commands
for cmd in ('rar', 'par2'):
if commands.getstatusoutput('which ' + cmd)[0] != 0:
print "Fatal error: cannot find the %s executable." % cmd
sys.exit()
This appears to work, but, as I'm just beginning with
python/programming, I thought there might be something in the standard
library that just does what I want. Am I recreating the wheel here?
--
Bradford R. Bowman
GnuPG Public Key available at:
http://mazirian.com/
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
