On 06/10/2013 18:40, intrigeri wrote:
> jvoisin wrote (06 Oct 2013 16:24:13 GMT) :
>>> There's surely a nicer way to detect if a program is in the path,
>>> isn't it?
>> Not really :/
>> shutil.which() is only available in Python 3.3
>
> As much as I like using libraries, the which algorithm (in the case
> when only a basename is given) is pretty trivial to implement.
>
> How about simply stealing Python 3.3's version? Looks like that part
> should be mostly enough:
>
> seen = set()
> for dir in path:
> normdir = os.path.normcase(dir)
> if not normdir in seen:
> seen.add(normdir)
> for thefile in files:
> name = os.path.join(dir, thefile)
> if _access_check(name, mode):
> return name
> return None
>
I used this instead:
os.check_output(['exiftool', '-ver'])It should work way better now :) commit: f843603
signature.asc
Description: OpenPGP digital signature

