Skip to content

Commit d6db5b3

Browse files
committed
Merge pull request 27 smarnach#27 which also exists in a different repo https://github.com/blurstudio/pyexiftool/tree/shell-option
1 parent 4d60d49 commit d6db5b3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Date (Timezone) | Version | Comment
88
07/17/2019 12:50:20 AM (PDT) | 0.1 | Convert leading spaces to tabs
99
07/17/2019 12:52:33 AM (PDT) | 0.1.1 | Merge [Pull request #10 "add copy_tags method"](https://github.com/smarnach/pyexiftool/pull/10) by [Maik Riechert (letmaik) Cambridge, UK](https://github.com/letmaik) on May 28, 2014<br> *This adds a small convenience method to copy any tags from one file to another. I use it for several month now and it works fine for me.*
1010
07/17/2019 01:05:37 AM (PDT) | 0.1.2 | Merge [Pull request #25 "Added option for keeping print conversion active. #25"](https://github.com/smarnach/pyexiftool/pull/25) by [Bernhard Bliem (bbliem)](https://github.com/bbliem) on Jan 17, 2019<br> *For some tags, disabling print conversion (as was the default before) would not make much sense. For example, if print conversion is deactivated, the value of the Composite:LensID tag could be reported as something like "8D 44 5C 8E 34 3C 8F 0E". It is doubtful whether this is useful here, as we would then need to look up what this means in a table supplied with exiftool. We would probably like the human-readable value, which is in this case "AF-S DX Zoom-Nikkor 18-70mm f/3.5-4.5G IF-ED".*<br>*Disabling print conversion makes sense for a lot of tags (e.g., it's nicer to get as the exposure time not the string "1/2" but the number 0.5). In such cases, even if we enable print conversion, we can disable it for individual tags by appending a # symbol to the tag name.*
11+
07/17/2019 01:20:15 AM (PDT) | 0.1.3 | Merge with slight modifications to variable names for clarity (Kevin Mak) [Pull request #27 "Add "shell" keyword argument to ExifTool initialization"](https://github.com/smarnach/pyexiftool/pull/27) by [Douglas Lassance (douglaslassance) Los Angeles, CA](https://github.com/douglaslassance) on 5/29/2019<br>*On Windows this will allow to run exiftool without showing the DOS shell.*<br>**This might break Linux but I don't know for sure**<br>Alternative source location with only this patch: https://github.com/blurstudio/pyexiftool/tree/shell-option
1112

1213

1314

exiftool.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ class ExifTool(object):
153153
associated with a running subprocess.
154154
"""
155155

156-
def __init__(self, executable_=None, print_conversion=False):
156+
def __init__(self, executable_=None, win_shell=True, print_conversion=False):
157+
self.win_shell = win_shell
157158
self.print_conversion = print_conversion
158159
if executable_ is None:
159160
self.executable = executable
@@ -179,10 +180,17 @@ def start(self):
179180
command.append("-n")
180181

181182
with open(os.devnull, "w") as devnull:
183+
startup_info = subprocess.STARTUPINFO()
184+
if not self.win_shell:
185+
SW_FORCEMINIMIZE = 11 # from win32con
186+
# Adding enum 11 (SW_FORCEMINIMIZE in win32api speak) will
187+
# keep it from throwing up a DOS shell when it launches.
188+
startup_info.dwFlags |= 11
189+
182190
self._process = subprocess.Popen(
183191
command,
184192
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
185-
stderr=devnull)
193+
stderr=devnull, startupinfo=startup_info)
186194
self.running = True
187195

188196
def terminate(self):

0 commit comments

Comments
 (0)