how to test for a dependency

Sybren Stuvel sybrenUSE at
Mon Jan 9 22:46:31 CET 2006

Darren Dale enlightened us with:
> I would like to test that latex is installed on a windows, mac or linux
> machine. What is the best way to do this? This should work:
> if os.system('latex -v'):
>     print 'please install latex'

The downside is that you can only use this to test by executing.
Perhaps it would be better to make a function that can search the PATH
environment variable in a cross-platform way. Also make sure you
include any platform-specific executable postfixes like Window's

The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa

More information about the Python-list mailing list