diff --git a/src/calibre/debug.py b/src/calibre/debug.py index dcad481c4f..58825d09e0 100644 --- a/src/calibre/debug.py +++ b/src/calibre/debug.py @@ -19,8 +19,7 @@ def run_calibre_debug(*args, **kw): import subprocess creationflags = 0 if iswindows: - import win32process - creationflags = win32process.CREATE_NO_WINDOW + creationflags = subprocess.CREATE_NO_WINDOW cmd = get_debug_executable() + list(args) kw['creationflags'] = creationflags return subprocess.Popen(cmd, **kw) diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 6cd2417539..6974a6a701 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -845,8 +845,7 @@ class Device(DeviceConfig, DevicePlugin): drives.append(x[0].upper()) def do_it(drives): - import win32process - subprocess.Popen([eject_exe()] + drives, creationflags=win32process.CREATE_NO_WINDOW).wait() + subprocess.Popen([eject_exe()] + drives, creationflags=subprocess.CREATE_NO_WINDOW).wait() t = Thread(target=do_it, args=[drives]) t.daemon = True diff --git a/src/calibre/ebooks/metadata/pdf.py b/src/calibre/ebooks/metadata/pdf.py index c1464b2f3e..8e4733bd7c 100644 --- a/src/calibre/ebooks/metadata/pdf.py +++ b/src/calibre/ebooks/metadata/pdf.py @@ -87,8 +87,7 @@ def page_images(pdfpath, outputdir='.', first=1, last=1, image_format='jpeg', pr outputdir = os.path.abspath(outputdir) args = {} if iswindows: - import win32process as w - args['creationflags'] = w.HIGH_PRIORITY_CLASS | w.CREATE_NO_WINDOW + args['creationflags'] = subprocess.HIGH_PRIORITY_CLASS | subprocess.CREATE_NO_WINDOW try: subprocess.check_call([ pdftoppm, '-cropbox', '-' + image_format, '-f', unicode_type(first), diff --git a/src/calibre/utils/ipc/launch.py b/src/calibre/utils/ipc/launch.py index a555e0fca0..78168ecd5b 100644 --- a/src/calibre/utils/ipc/launch.py +++ b/src/calibre/utils/ipc/launch.py @@ -15,7 +15,6 @@ from polyglot.builtins import string_or_bytes, environ_item, native_string_type, from polyglot.binary import as_hex_unicode if iswindows: - import win32process try: windows_null_file = open(os.devnull, 'wb') except: @@ -160,10 +159,10 @@ class Worker(object): } if iswindows: priority = { - 'high' : win32process.HIGH_PRIORITY_CLASS, - 'normal' : win32process.NORMAL_PRIORITY_CLASS, - 'low' : win32process.IDLE_PRIORITY_CLASS}[priority] - args['creationflags'] = win32process.CREATE_NO_WINDOW|priority + 'high' : subprocess.HIGH_PRIORITY_CLASS, + 'normal' : subprocess.NORMAL_PRIORITY_CLASS, + 'low' : subprocess.IDLE_PRIORITY_CLASS}[priority] + args['creationflags'] = subprocess.CREATE_NO_WINDOW|priority else: niceness = { 'normal' : 0, diff --git a/src/calibre/utils/ipc/simple_worker.py b/src/calibre/utils/ipc/simple_worker.py index bf4618660a..642ee9fb9d 100644 --- a/src/calibre/utils/ipc/simple_worker.py +++ b/src/calibre/utils/ipc/simple_worker.py @@ -147,12 +147,11 @@ def start_pipe_worker(command, env=None, priority='normal', **process_args): args = {'stdout':subprocess.PIPE, 'stdin':subprocess.PIPE, 'env':w.env} args.update(process_args) if iswindows: - import win32process priority = { - 'high' : win32process.HIGH_PRIORITY_CLASS, - 'normal' : win32process.NORMAL_PRIORITY_CLASS, - 'low' : win32process.IDLE_PRIORITY_CLASS}[priority] - args['creationflags'] = win32process.CREATE_NO_WINDOW|priority + 'high' : subprocess.HIGH_PRIORITY_CLASS, + 'normal' : subprocess.NORMAL_PRIORITY_CLASS, + 'low' : subprocess.IDLE_PRIORITY_CLASS}[priority] + args['creationflags'] = subprocess.CREATE_NO_WINDOW|priority else: niceness = {'normal' : 0, 'low' : 10, 'high' : 20}[priority] args['env']['CALIBRE_WORKER_NICENESS'] = str(niceness) diff --git a/src/calibre/utils/test_lock.py b/src/calibre/utils/test_lock.py index 893e079efe..674ebb21a2 100644 --- a/src/calibre/utils/test_lock.py +++ b/src/calibre/utils/test_lock.py @@ -50,8 +50,7 @@ def run_worker(mod, func, **kw): env = kw.get('env', os.environ.copy()) env['CALIBRE_SIMPLE_WORKER'] = mod + ':' + func if iswindows: - import win32process - kw['creationflags'] = win32process.CREATE_NO_WINDOW + kw['creationflags'] = subprocess.CREATE_NO_WINDOW kw['env'] = {native_string_type(k): native_string_type(v) for k, v in iteritems(env)} # windows needs bytes in env return subprocess.Popen(exe, **kw)