self.process.stdin.flush()

def execute(self, *args):
    args = args + ('-execute\n',)
self.process.stdin.write(str.join('\n', args))
self.process.stdin.flush()
output = ''
fd = self.process.stdout.fileno()
while not output.endswith(self.sentinel):
    output += os.read(fd, 4096)
return output[:-len(self.sentinel)]

def get_metadata(self, *filenames):
    return json.loads(self.execute('-G', '-j', '-n', *filenames))
Call exiftool from a python script?