Skip to content

Add "shell" keyword argument to ExifTool initialization #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions exiftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ 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:
Expand All @@ -167,11 +168,16 @@ def start(self):
warnings.warn("ExifTool already running; doing nothing.")
return
with open(os.devnull, "w") as devnull:
startupInfo = subprocess.STARTUPINFO()
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
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):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]",
url="http://github.com/smarnach/pyexiftool",
url="https://github.com/blurstudio/pyexiftool/tree/shell-option",
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
Expand Down