[Node] ExtractMetadata: Replace os.system with subprocess.Popen

This commit is contained in:
Vincent Demoulin 2025-01-31 11:29:29 +01:00
parent f1d68b660c
commit 3e854e7b38

View file

@ -7,6 +7,7 @@ import distutils.dir_util as du
import shutil import shutil
import glob import glob
import os import os
import subprocess
class ExtractMetadata(desc.Node): class ExtractMetadata(desc.Node):
@ -106,10 +107,10 @@ Using exifTool, this node extracts metadata of all images referenced in a sfmDat
else: #xmp else: #xmp
cmd = 'exiftool -tagsfromfile ' + iFile + ' ' + chunk.node.arguments.value.strip() + ' ' + oFile cmd = 'exiftool -tagsfromfile ' + iFile + ' ' + chunk.node.arguments.value.strip() + ' ' + oFile
chunk.logger.debug(cmd) chunk.logger.debug(cmd)
try: error = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr.read().decode()
os.system(cmd) chunk.logger.debug(error)
except: if error != "":
chunk.logger.error("exifTool command failed ! Check that exifTool can be accessed on your system.") chunk.logger.error(error)
raise RuntimeError(error) raise RuntimeError(error)
if not os.path.exists(oFile): if not os.path.exists(oFile):
info = 'No metadata extracted for file ' + iFile info = 'No metadata extracted for file ' + iFile