diff --git a/oml/media/pdf.py b/oml/media/pdf.py index dbcb5db..5238685 100644 --- a/oml/media/pdf.py +++ b/oml/media/pdf.py @@ -61,7 +61,13 @@ def page(pdf, page): '-scale-to', '1024', '-cropbox', os.path.join(tmp, 'page') ] - p = subprocess.Popen(cmd, close_fds=True) + if sys.platform == 'win32': + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = subprocess.SW_HIDE + p = subprocess.Popen(cmd, close_fds=True, startupinfo=startupinfo) + else: + p = subprocess.Popen(cmd, close_fds=True) p.wait() image = glob('%s/*' % tmp) if image: @@ -229,6 +235,11 @@ def extract_text(pdf): if sys.platform == 'win32': pdf = get_short_path_name(pdf) cmd = ['pdftotext', pdf, '-'] + if sys.platform == 'win32': + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + startupinfo.wShowWindow = subprocess.SW_HIDE + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, startupinfo=startupinfo) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() stdout = stdout.decode() diff --git a/oml/utils.py b/oml/utils.py index 34f01ea..fad7535 100644 --- a/oml/utils.py +++ b/oml/utils.py @@ -368,7 +368,7 @@ def open_folder(folder=None, path=None): elif sys.platform.startswith('linux'): cmd += ['xdg-open', folder] elif sys.platform == 'win32': - path = '\\'.join(folder.split('/')) + path = '\\'.join(path.split('/')) os.system('explorer.exe /select,"%s"' % path) cmd = [] else: