Python Forum
Embedding Args in external program call - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Embedding Args in external program call (/thread-3259.html)



Embedding Args in external program call - brizflysdrones - May-09-2017

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"



RE: Embedding Args in external program call - buran - May-09-2017

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


RE: Embedding Args in external program call - wavic - May-09-2017

He/she maybe is using it.

from subprocess import call



RE: Embedding Args in external program call - buran - May-09-2017

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


RE: Embedding Args in external program call - brizflysdrones - May-09-2017

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"



RE: Embedding Args in external program call - buran - May-09-2017

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"