pythonのinteractive shellを終了した後 `stty sane` が必要だった問題が解決したという話

はじめに

手元の環境でpythonのinteractive shellを利用した後、コンソールで入力した文字列のエコー表示がされなくなる問題に悩まされていた。

$ python3.5
Python 3.5.2 (default, Sep 19 2016, 02:49:52) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D>>> 
$ # ここで入力した文字列が表示されなくなってしまう
$ stty sane #これで復活

readlineを有効にせずにbuildしていた模様

readlineを有効にせずにpythonをinstallしていた模様。

$ port installed python35
The following ports are currently installed:
   python35 @3.5.2_0 (active)
$ port variants python35
python35 has the variants:
   readline: Use readline instead of libedit
   universal: Build for multiple architectures
$ sudo port clean python35
$ sudo port install python35 +readline
The following ports are currently installed:
  python35 @3.5.2_0
  python35 @3.5.2_0+readline (active)

無事は stty sane は不要になった。