Skip to content

Commit bf57d23

Browse files
nanoantAdamVarian
authored andcommitted
Prevent creating new console on Windows
When running Jupyter via pythonw e.g. pythonw -m qtconsole, jupyter_client launches new kernel via python.exe which is a console application on Windows - a side-effect of that is a new empty console window created and shown as long as kernel is running. This patch adds CREATE_NO_WINDOW 0x08000000 to Windows specific creationflags. This flag is not exported by subprocess module therefore has to be provides numerically.
1 parent 3058347 commit bf57d23

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jupyter_client/launcher.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ def launch_kernel(cmd, stdin=None, stdout=None, stderr=None, env=None,
111111
DUPLICATE_SAME_ACCESS)
112112
env['JPY_PARENT_PID'] = str(int(handle))
113113

114+
# Prevent creating new console window on pythonw
115+
if redirect_out:
116+
kwargs['creationflags'] = kwargs.setdefault('creationflags', 0) | 0x08000000 # CREATE_NO_WINDOW
117+
114118
else:
115119
# Create a new session.
116120
# This makes it easier to interrupt the kernel,

0 commit comments

Comments
 (0)