From 02290ced012e7206f8777322740edf152d5ae910 Mon Sep 17 00:00:00 2001 From: Douglas Lassance Date: Wed, 29 May 2019 16:57:04 -0700 Subject: [PATCH 1/3] Add "shell" keyword argument to start method On Windows this will allow to run exiftool without showing the DOS shell. --- exiftool.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exiftool.py b/exiftool.py index 8a11daa..14e20d9 100644 --- a/exiftool.py +++ b/exiftool.py @@ -155,7 +155,7 @@ def __init__(self, executable_=None): self.executable = executable_ self.running = False - def start(self): + def start(self, shell=True): """Start an ``exiftool`` process in batch mode for this instance. This method will issue a ``UserWarning`` if the subprocess is @@ -167,11 +167,16 @@ def start(self): warnings.warn("ExifTool already running; doing nothing.") return with open(os.devnull, "w") as devnull: + startupInfo = subprocess.STARTUPINFO() + if not shell: + # Adding enum 11 (SW_FORCEMINIMIZE in win32api speak) will + # keep it from throwing up a DOS shell when it launches. + startupInfo.dwFlags |= 11 self._process = subprocess.Popen( [self.executable, "-stay_open", "True", "-@", "-", "-common_args", "-G", "-n"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=devnull) + stderr=devnull, startupinfo=startupInfo) self.running = True def terminate(self): From d016bd8cb8a2a09f1873b376bdbfc754e44b612f Mon Sep 17 00:00:00 2001 From: Douglas Lassance Date: Mon, 3 Jun 2019 13:39:00 -0700 Subject: [PATCH 2/3] Move shell keyword argument on class initialization This will define the shell behavior for all instantiated contexts. --- exiftool.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exiftool.py b/exiftool.py index 14e20d9..4f3aeb9 100644 --- a/exiftool.py +++ b/exiftool.py @@ -148,14 +148,15 @@ class ExifTool(object): associated with a running subprocess. """ - def __init__(self, executable_=None): + def __init__(self, executable_=None, shell=True): + self.shell = shell if executable_ is None: self.executable = executable else: self.executable = executable_ self.running = False - def start(self, shell=True): + def start(self): """Start an ``exiftool`` process in batch mode for this instance. This method will issue a ``UserWarning`` if the subprocess is @@ -168,7 +169,7 @@ def start(self, shell=True): return with open(os.devnull, "w") as devnull: startupInfo = subprocess.STARTUPINFO() - if not shell: + if not self.shell: # Adding enum 11 (SW_FORCEMINIMIZE in win32api speak) will # keep it from throwing up a DOS shell when it launches. startupInfo.dwFlags |= 11 From cd140faddf61e8ee9f560bd59854363bd75eda9f Mon Sep 17 00:00:00 2001 From: Douglas Lassance Date: Mon, 3 Jun 2019 17:00:36 -0700 Subject: [PATCH 3/3] Update version number for distribution --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 03e9436..fac724f 100644 --- a/setup.py +++ b/setup.py @@ -17,12 +17,12 @@ from distutils.core import setup setup(name="PyExifTool", - version="0.1", + version="0.1.1.post1", description="Python wrapper for exiftool", license="GPLv3+", author="Sven Marnach", author_email="sven@marnach.net", - url="http://github.com/smarnach/pyexiftool", + url="https://github.com/blurstudio/pyexiftool/tree/shell-option", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers",