Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python OSError异常';[Errno 2]没有这样的文件或目录';使用子流程时,请检查_output()_Python_Python 2.7_Subprocess_Exiftool - Fatal编程技术网

Python OSError异常';[Errno 2]没有这样的文件或目录';使用子流程时,请检查_output()

Python OSError异常';[Errno 2]没有这样的文件或目录';使用子流程时,请检查_output(),python,python-2.7,subprocess,exiftool,Python,Python 2.7,Subprocess,Exiftool,我正在尝试使用subprocess执行ExifTool read命令从jpg文件读取元信息 调用get_dimensions()的函数首先创建文件,将其文件路径存储在file_name中——我仔细检查了,它确实存在于它应该存在的地方——并最终调用get_dimensions()。在此函数中调用subprocess.check_output()始终会引发操作错误。顺便说一下,我正在Python2.7.10上运行pytest def get_dimensions(self, file_name):

我正在尝试使用subprocess执行ExifTool read命令从jpg文件读取元信息

调用get_dimensions()的函数首先创建文件,将其文件路径存储在file_name中——我仔细检查了,它确实存在于它应该存在的地方——并最终调用get_dimensions()。在此函数中调用subprocess.check_output()始终会引发操作错误。顺便说一下,我正在Python2.7.10上运行pytest

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)
错误是:

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])

原来我没有安装exiftool。

原来我没有安装exiftool