I am trying to read meta information from a jpg file using subprocess to execute an ExifTool read command.
The function that calls get_dimensions() first creates the file, stores its file path in file_name--I double-checked and it does indeed exist where it should--and eventually calls get_dimensions(). Calling subprocess.check_output() in this function always raises an OSError. I'm running pytest on python 2.7.10 by the way.
def get_dimensions(self, file_name):
exiftool = subprocess.check_output(['exiftool', '-j', file_name])
exif = json.loads(exiftool)[0]
width, height = (exif.get('ImageWidth', 0), exif.get('ImageHeight', 0))
return (width, height)
The error is:
Exception has occurred: OSError
[Errno 2] No such file or directory
File "/Users/derek/m-app-tests/tests/TestUtils/client_api.py", line 428, in get_dimensions
exiftool = subprocess.check_output(['exiftool', '-j', file_name])