Knowledge Base/Canopy/Specific Canopy packages

Canopy Python prompt (QtConsole) - Can't run getpass, or interactive OS shell commands, or (Windows) process Ctrl+C

Jonathan March
posted this on July 08, 2013 13:17

(Updated November 19, 2013)

Canopy's main IPython shell is an IPython QtConsole. While QtConsole has many advantages over a plain IPython terminal (especially editing multi-line commands and supporting inline graphics), it does have a few longstanding difficult limitations. These include:

1) The Python standard library's getpass.getpass(), effectively freezes because it can't receive the input from standard input. See

The workaround is to write a GUI dialog, for example using traitsui.

2) Shell commands which require interactive input (e.g. a confirmation prompt from a `rm filename` command), effectively freeze because they cannot receive user input.


Currently, the only workaround is not to use any such commands (e.g. use `rm -f filename` to avoid a confirmation prompt -- but be careful!)

If you do freeze in this way, typing Control+C should return you to the ipython prompt.

3) On Windows, you cannot interrupt an "input" or "raw_input" command by typing Ctrl+C or Ctrl+Break


The workaround is to tell your users to just hit Enter (or some similar agreed-on convention) to interrupt, and then handle the empty input appropriately, or use a GUI interface.

If it happens anyway, you can use the "Restart Kernel" command in Canopy's Run menu.


We do intend to mitigate these issues as much as feasible. Our apologies for the inconvenience.