how to test for a dependency

Darren Dale dd55 at cornell.edu
Mon Jan 9 16:56:34 EST 2006


Sybren Stuvel wrote:

> 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
> ".exe".

I guess that would work. I was hoping there was a more elegant, batteries
included way to do it.

By the way, great Zappa quote.



More information about the Python-list mailing list