Question

I'm used to ending the python interactive interpreter using Ctrl-d using Linux and OS X. On windows though, you have to use CTRL+Z and then enter. Is there any way to use CTRL+D?

Was it helpful?

Solution

Ctrl-d works to exit from IPython
(installed by python(x,y) package).

  • OS: WinXP
  • Python version: 2.5.4

Edit: I've been informed in the comments by the OP, Jason Baker, that Ctrl-d functionality on Windows OSes is made possible by the PyReadline package: "The pyreadline package is a python implementation of GNU readline functionality it is based on the ctypes based UNC readline package by Gary Bishop. It is not complete. It has been tested for use with windows 2000 and windows xp."


Since you're accustomed to *nix you may like that IPython also offers *nix-like shell functionality without using something like Cygwin...

  • Proper bash-like tab completion.
  • Use of / instead of \, everywhere
  • Persistent %bookmark's
  • %macro
  • %store. Especially when used with macros and aliases.
  • cd -. (easily jump around directory history). Directory history persists across sessions.
  • %env (see cookbook)
  • Shadow history - %hist and %rep (see cookbook)
  • %mglob
  • Expansion of $python_variables in system commands
  • var = !ls -la (capture command output to handy string lists)

OTHER TIPS

You can't use CTRL+D on windows.

CTRL+Z is a windows-specific control char that prints EOF. On *nix, it is typically CTRL+D. That's the reason for the difference.

You can, however, train yourself to use exit(), which is cross-platform.

You can change the key set that Idle should be using.

  1. Under Options->"Configure IDLE..." go to the "Keys" tab.

  2. On the right you can select the "IDLE Classic Unix" key set.

Run Cygwin Python if windowisms are bothering you... Unless what you are doing depends on pywin32 that is.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top