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

(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 https://github.com/ipython/ipython/issues/854

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.

See https://github.com/ipython/ipython/issues/514. 

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

See https://github.com/ipython/ipython/issues/1322.

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.

Have more questions? Submit a request

Comments

  • Avatar
    Kevin Fine

    I came across this with the package msvcrt, which normally allows one to pause a running program. It does not respond to keyboard input in the Canopy window. If the attached script is ran in Canopy it does not terminate, and you must Restart Kernel. However it stops fine with an IPython window.

Powered by Zendesk