便利そうなのでIPythonを使ってみることにした。
MacPortsでpy-readlineとpy25-ipythonをインストール。
詳しい使い方はこのへんを参照。
ターミナルでipythonと入力すると使えるようになる。
が、carbon emacsでeshellから使ったらプロンプトが文字化け。
In[1]とかなるべきところが
[0;32mIn [[1;32m1[0;32m]: [0;00m
このようになる。
ググってみた。
IPython User Manualのこのあたりになにやら書いてある。
Input/Output prompts and exception tracebacks
You can test whether the colored prompts and tracebacks work on your system interactively by typing '%colors Linux' at the prompt (use '%colors LightBG' if your terminal has a light background). If the input prompt shows garbage like:
[0;32mIn [[1;32m1[0;32m]: [0;00m
instead of (in color) something like:
In [1]:
this means that your terminal doesn't properly handle color escape sequences. You can go to a 'no color' mode by typing '%colors NoColor'.You can try using a different terminal emulator program (Emacs users, see below). To permanently set your color preferences, edit the file $HOME/.ipython/ipythonrc and set the colors option to the desired value.
$HOME/.ipython/ipythonrcの中の
#colors NoColor
の#を取ればよいみたい。
で、動いた(゚Д゚)
が、colors NoColorってやったからeshellでIPython使うと通常In[1]・Out[1]とか色分けされるとこが色つかないのはわかる。でもM-x shellの方で使うと色がつく。
なんで?
とりあえず、shellでテスト
In [1]: a = 1 In [2]: a Out[2]: 1 In [3]: b = [1,2,3] In [4]: b Out[4]: [1, 2, 3] In [5]: b.append(a) In [6]: b Out[6]: [1, 2, 3, 1]
使えた。
今度は日本語で。
In [7]: c = u"あいうえお" WARNING: ******** You or a %run:ed script called sys.stdin.close() or sys.stdout.close()! Exiting IPython!
日本語を入力したら。IPython強制終了(´・ω・`)
c = "あいうえお" でもだめだった。
とりあえず保留の方向で...
環境-----------------------------------------
MacOSX10.3
Carbon Emacs for Panther0706
Python2.5.1
IPython0.8.2