What is -n for

27 Aug, 2013

John writes:

Quick question regarding the -n used in the shortcut for IDLE. I realize that it starts IDLE with no subprocesses, but what does that mean and why do we want to do it?

There's precious little on the net describing what the -n switch does. From the IDLE documentation:

If IDLE is started with the -n command line switch it will run in a single process and will not create the subprocess which runs the RPC Python execution server. This can be useful if Python cannot create the subprocess or the RPC socket interface on your platform. However, in this mode user code is not isolated from IDLE itself. Also, the environment is not restarted when Run/Run Module (F5) is selected. If your code has been modified, you must reload() the affected modules and re-import any specific items (e.g. from foo import baz) if the changes are to take effect. For these reasons, it is preferable to run IDLE with the default subprocess if at all possible.

Which, I admit, doesn't help a huge amount...

For the purposes of Python for Kids however, all you really need to know is that certain graphical libraries (such as turtle and, I seem to recall, tkinter) will exhibit weird behaviour (such as locking up/hanging) if you don't run IDLE using the -n switch.