Python Forum

Full Version: Embedding Args in external program call
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Needing to make a this os call happen stuck on how to do it.
print fname+ " %d Plants Detected" % len(keypoints)
need to preform the following
exiftool -description="%d" fname

 # Detect.
    reversemask=255-mask
    keypoints = detector.detect(reversemask)
    if keypoints:
        print fname+ " %d Detected" % len(keypoints)
        call([exiftool -description="%d" fname])
    else:
        print "No Found"
Your code has nothing to do with call to external program.  Please, post your actual code that you have problem with. You may want to check subprocess module
He/she maybe is using it.

from subprocess import call
Yes, however he/she edited the post to add the line

call([exiftool -description="%d" fname])
that's why I strike trough part of my post
subprocess.call(['exiftool', '-description='+str(len(keypoints)), fname]) is where im stuck at

Needing to make a this os call happen stuck on how to do it.
print fname+ " %d Plants Detected" % len(keypoints)
need to preform the following
exiftool -description="%d" fname

 # Detect.
    reversemask=255-mask
    keypoints = detector.detect(reversemask)
    if keypoints:
        print fname+ " %d Detected" % len(keypoints)
       call([exiftool -description="%d" fname])
    else:
        print "No Found"
try this

# Detect.
   reversemask=255-mask
   keypoints = detector.detect(reversemask)
   if keypoints:
       args1 = '-description={}'.format(len(keypoints))
       print '{} {} Detected'.format(fname, len(keypoints))
       call(['exiftool', args1, fname])
   else:
       print "No Found"