質問の更新: In[1]: プロンプトがないのはなぜですか?
Emacs での IPython コマンド ラインの次の出力を参照してください。
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
import sys
sys.path
Out[4]:
['',
'C:\\Python25\\scripts',
'C:\\Python25\\lib\\site-packages\\pyflakes-0.4.0-py2.5.egg',
'C:\\Python25\\lib\\site-packages\\pylint-0.21.3-py2.5.egg',
'C:\\Python25\\lib\\site-packages\\logilab_astng-0.20.3-py2.5.egg',
'C:\\Python25\\lib\\site-packages\\logilab_common-0.52.0-py2.5.egg',
'C:\\Python25\\lib\\site-packages\\unittest2-0.5.1-py2.5.egg',
'C:\\Python25\\Lib\\site-packages\\pyflakes',
'C:\\Python25\\Lib\\site-packages\\Pymacs',
'C:\\Python25\\Lib\\site-packages\\rope',
'C:\\Python25\\Lib\\site-packages\\ropemacs',
'C:\\Python25\\Lib\\site-packages\\ropemode',
'C:\\WINDOWS\\system32\\python25.zip',
'C:\\Python25\\DLLs',
'C:\\Python25\\lib',
'C:\\Python25\\lib\\plat-win',
'C:\\Python25\\lib\\lib-tk',
'C:\\Python25',
'C:\\Python25\\lib\\site-packages',
'C:\\Python25\\lib\\site-packages\\win32',
'C:\\Python25\\lib\\site-packages\\win32\\lib',
'C:\\Python25\\lib\\site-packages\\Pythonwin',
'C:\\Python25\\lib\\site-packages\\IPython/Extensions',
u'C:\\Home\\_ipython']
やあ、
Windows XP で IPython 0.10、Python 2.5、EmacsW32 23.1 および ipython.el Rev.2927 を使用しています。Emacs で python-shell を呼び出すと、常にクラッシュします。誰かがこの問題を解決できますか? どうもありがとう!
更新: https://bugs.launchpad.net/ipython/+bug/290228の修正を試みましたが、役に立ちません。
IPython は、次の長いデバッグ情報でクラッシュします。
エラー: 入力のトークン化中に予期しないエラーが発生しました 次のトレースバックは破損しているか無効である可能性があります エラー メッセージ: ('EOF in multi-line statement', (14, 0))
-------------------------------------------------- ------------------------- TypeError
Python 2.5.2: C: \Python25\python.exe Thu Sep 30 14:00:08 2010 問題Python コードの実行中に発生しました。エラーが発生するまでの一連の関数呼び出しを次に示します。最新の (最も内側の) 呼び出しが最後です。c:\Python25\Scripts\ipython-script.py in () 1 2 3 4 5 6 7 ----> 8 グローバル load_entry_point = 9 #!C:\Python25\python.exe 10 # EASY-INSTALL-ENTRY- SCRIPT: 'ipython==0.10','console_scripts','ipython' 11 requires = 'ipython==0.10' 12 import sys 13 from pkg_resources import load_entry_point 14 15 sys.exit( 16 load_entry_point('ipython==0.10', ' console_scripts', 'ipython')() 17 ) 18 19 20 21 22 23 24 25 26 27 28 29 30 31
562 563 これにより、有効な IPython ユーザー名前空間として動作するために必要な最小限の情報で dict が構築され、これを ipython のさまざまな埋め込みクラスに渡すことができます。566 567 この API は現在非推奨です。568 の代わりに ipapi.make_user_namespaces() を使用して、ローカルとグローバルの両方の名前空間オブジェクトを同時に作成します。569 570 : パラメータ: 571 user_ns : dict のような、オプション 562 563 これにより、有効な IPython ユーザー名前空間として動作するために必要な最小限の情報で dict が構築され、これを ipython のさまざまな埋め込みクラスに渡すことができます。566 567 この API は現在非推奨です。568 の代わりに ipapi.make_user_namespaces() を使用して、ローカルとグローバルの両方の名前空間オブジェクトを同時に作成します。569 570 : パラメータ: 571 user_ns : dict のような、オプション
C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\ipapi.pyc in make_session(user_ns=None, shellclass=None) 669 670 def make_session(user_ns=None, shellclass=None) : 671 """IPython セッションを作成しますが、起動しません。 672 673 後で、返されたオブジェクトで obj.mainloop() を呼び出すことができます。 674 675 入力: 676 677 - user_ns(None): として使用される辞書678 初期データを持つユーザーの名前空間 679 680 警告: これは使用しないでください""" 681 682 import IPython.Shell 683 shellclass が None の場合: --> 684 return IPython.Shell.start(user_ns) 685 return shellclass(user_ns = user_ns) 686 687 688 689 690 691 692 693 694 695 696 697 698 699
C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\Shell.pyc in start(user_ns=None) 1226
th_mode = special_opts.pop()
KeyError を除く 1227: 1228
th_mode = 'tkthread ' 1229
return th_shell[th_mode] 1230
1231 1232 # これは、外部コードによって呼び出されるべきものです。
1233 def start(user_ns = None):
1234 """実行中のシェル インスタンスを返し、スレッド オプションを処理します。 1235 1236 これは
、ユーザーのスレッド選択に基づいて適切な IPython シェルをインスタンス化するファクトリ関数です。 1238 異なる GUI ツールキットには異なるスレッド処理の詳細が必要なため、必要です。""" 1239 1240
shell = _select_shell(sys.argv) -> 1241 return shell(user_ns = user_ns) 1242 1243 # 下位互換性のためのいくつかのエイリアス
1244 IPythonShell = IPShell 1245 IPythonShellEmbed = IPShellEmbed
1246 # * ** * ** * ** * ** End ofファイル * ** * ** * ** * ** * 1247 1248 1249 1250 1251 1252
1253 1254 1255 1256C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\Shell.pyc in init (self=、argv=なし、user_ns=なし、user_global_ns=なし、debug=1、shell_class= ) 58 # マルチスレッドシェルを待機するためのデフォルトのタイムアウト (秒単位) 59 GUI_TIMEOUT = 10 60 61
-------------------------------------------------- ---------------------------
62 # This class is trivial now, but I want to have it in to publish a
きれいな 63 # インターフェイス。後で内部が再編成されたときに、この 64 # を使用するコードを変更する必要はありません。65 66 クラス IPShell: 67 """IPython インスタンスを作成します。""" 68 69 def init(self,argv=None,user_ns=None,user_global_ns=None, 70 debug=1,shell_class=InteractiveShell): 71 self.IP = make_IPython(argv,user_ns=user_ns, 72 user_global_ns=user_global_ns, ---> 73 debug= debug,shell_class=shell_class) global that = undefined global gets = undefined global prepended = undefined global to = undefined global all = undefined global calls = undefined global so = undefined global header = undefined global used = undefined 74 75 def mainloop(self,sys_exit =0,banner=None): 76 self.IP.mainloop(banner) 77 if sys_exit: 78 sys.exit() 79 80
-------------------------------------------------- ---------------------------
81 def kill_embedded(self,parameter_s=''): 82 """%kill_embedded : deactivate for good the current
埋め込まれた IPython。83 84 この関数は (確認を求めた後) 内部フラグを設定し、埋め込まれた IPython が二度とアクティブにならないようにします。これは、ループ内で呼び出されているシェルを永久に無効にするのに役立ちます: シェルから必要なものを見つけたら、それを強制終了することができます。プログラムは対話型シェルが再度干渉することなく実行を継続します。 .
C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\ipmaker.pyc in make_IPython(argv=[r'c:\Python25\Scripts\ipython-script.py', '- i']、user_ns=なし、user_global_ns=なし、debug=1、rc_override=なし、shell_class=、embedded=False、kw={}) 755 IP_rc.banner = 0 756 if IP_rc.banner: 757 BANN_P = IP.BANNER_PARTS 758 else: 759 BANN_P = [] 760 761 if IP_rc.profile: BANN_P.append('IPython profile: %s\n ' % IP_rc.profile) 762 763 # メッセージログを追加 (おそらく空) 764 if msg.summary: BANN_P.append(msg.summary) 765 # 最終バナーは文字列 766 IP.BANNER = '\n'.join(BANN_P ) 767 768 # IPython インスタンスをファイナライズします。これは、rc 構造が完全に整っていることを前提としています。--> 770 IP.post_config_initialization() 771 772 return IP 773 # * ** * ** * ** * ****ファイルの終わり
774 775 776 777 778 779 780 781 782 783 784 785
C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\iplib.pyc in post_config_initialization(self=) 847 これは、構成ファイルが処理されて初期化が 848 'ファイナライズ' された後に呼び出されます。 .""" 849 850 rc = self.rc 851 852 # オブジェクト インスペクター 853 self.inspector = OInspect.Inspector(OInspect.InspectColors, 854 PyColorize.ANSICodeColors, 855 'NoColor', 856 rc.object_info_string_level) 857 858 self.rl_next_input =なし 859 self.rl_do_indent = False 860 # 適切な readline を読み込む 861 if rc.readline: --> 862 self.init_readline() 863 864 # ローカル ショートカット、これは LOT で使用されます 865 self.log = self.logger.log 866 867 # キャッシュを初期化し、in/out プロンプトと印刷システムを設定します 868 self.outputcache = CachedOutput(self, 869 rc.cache_size, 870 rc.pprint, 871 input_sep = rc.separate_in、872 output_sep = rc.separate_out、873 output_sep2 = rc.separate_out2、874 ps1 = rc.prompt_in1、875 ps2 = rc.prompt_in2、876 ps_out = rc.prompt_out、877 pad_left = rc.prompts_pad_left)
C:\Python25\lib\site-packages\ipython-0.10-py2.5.egg\IPython\iplib.pyc init_readline(self=) 1476
readline.uses_libedit でない場合: 1477 self.rc.readline_parse_and_bind の rlcommand:
1478 #print "loading rl:",rlcommand # dbg 1479 readline.parse_and_bind(rlcommand)
1480 1481 # 区切りリストからいくつかの文字を削除します。# 1482 個の unicode 文字に遭遇した場合は、それらを破棄します。1483
delims = readline.get_completer_delims().encode("ascii", "ignore") 1484 delims = delims.translate(string._idmap,
1485 self.rc.readline_remove_delims)
1486
readline.set_completer_delims(delims) 1487 # そうしないと、しばらくするとモンスターの履歴になってしまう: 1488
readline.set_history_length(1000)
1489 try: 1490print ' * readline の履歴を読み込んでいます' # dbg
-> 1491 readline.read_history_file(self.histfile) 1492 except IOError:
1493 pass # まだ存在しません。1494 1495
atexit.register(self.atexit_operations) 1496 del atexit 1497
1498 # すべてのプラットフォームの自動インデントを設定する 1499
self.set_autoindent(self.rc.autoindent) 1500 1501 def ask_yes_no(self,prompt,default=True): 1502 if self.rc.quiet: 1503 return True 1504 return ask_yes_no(prompt,default) 1505
1506 def new_main_mod(self,ns=None):C:\Python25\lib\site-packages\pyreadline\rlmain.pyc in read_history_file(self=, filename=u'C:\Home\_ipython\history') 168 169 def set_history_length (self, length): 170 '''履歴ファイルに保存する行数を設定します。171 172 write_history_file() は、この値を使用して、保存時に履歴ファイルを切り捨てます。負の値は、無制限の履歴ファイル サイズを意味します。174 ''' 175 self._history.set_history_length(length) 176 177 def clear_history(self): 178 '''readline履歴をクリアする''' 179 self._history.clear_history() 180 181 def read_history_file(self, filename=None) : 182 '''readline履歴ファイルをロードします。デフォルトのファイル名は ~/.history.''' --> 183 self._history.read_history_file(filename) 184 185 def write_history_file(self, filename=None): 186 ''' readline 履歴ファイルを保存します。デフォルトのファイル名は ~/.history.''' 187 self._history.write_history_file(filename) 188 189 #Completer functions 190 191 def set_completer(self, function=None): 192 '''Completer 関数を設定または削除します。193 194 関数が指定されている場合、それは新しいコンプリータ関数として使用されます。省略またはなしの場合、すでにインストールされているコンプリータ機能は削除されます。コンプリータ関数は 197 function(text, state) として呼び出され、状態が 0、1、2、.. .、198 非文字列値が返されるまで。次の可能な完了を返す必要があります
C:\Python25\lib\site-packages\pyreadline\lineeditor\history.pyc in read_history_file(self=, filename=u'C:\Home\_ipython\history') 55 56 history_length=property(get_history_length,set_history_length) 57 history_cursor =property(get_history_cursor,set_history_cursor) 58 59 def clear_history(self): 60 '''readline の履歴を消去します。''' 61 self.history[:] = [] 62 self.history_cursor = 0 63 64 def read_history_file(self, filename =None): 65 '''readline 履歴ファイルをロードします。''' 66 if filename is None: 67 filename=self.history_filename 68 try: 69 for line in open(filename, 'r'): ---> 70自己。add_history(lineobj.ReadLineTextBuffer(ensure_unicode(line.rstrip()))) グローバル n = 未定義のグローバル Xd = 未定義のグローバル S = 未定義のグローバル NR = 未定義のグローバル i = 未定義のグローバル R2 = 未定義のグローバル R = 未定義のグローバル t = 未定義のグローバル history_search_forwardt = 未定義のグローバル history_search_backwardt = 未定義のグローバル joinR2 = 未定義グローバル maxR = 未定義 グローバル mint = 未定義 グローバル IndexError = 未定義 グローバル RX = 未定義 グローバル partialt = 未定義 グローバル hcstartt = 未定義 グローバル hct = 未定義 グローバル ht = 未定義 グローバル 結果 = 未定義 グローバル s = 未定義 グローバル C = 未定義 グローバル Python25 = 未定義 グローバル lib =未定義グローバル サイト = 未定義のグローバル パッケージ = 未定義のグローバル pyreadline = グローバル lineeditor = 未定義のグローバル history.pyt = 未定義のグローバル検索 = 未定義のグローバル I = 未定義のグローバル c = 未定義のグローバル d = 未定義のグローバル 検索 = 未定義のグローバル forward = 未定義のグローバル through = 未定義のグローバル the = 未定義のグローバル 履歴 = 未定義のグローバルglobal start = 未定義 global current = 未定義 line = 'import sys\n' global point.This = 未定義 global a = 未定義 global non = 未定義 global incremental = 未定義 global search.By = 未定義 global default = 未定義グローバル this = 未定義グローバル コマンド= 未定義のグローバル アンバウンド。i = 未定義のグローバル Rj = 未定義のグローバル Re = 未定義のグローバル q = 未定義のグローバル history.pyR= 未定義のグローバル後方 = 未定義のグローバル Rk = 未定義のグローバル history.pyR = 未定義のグローバル N = 未定義のグローバル プロパティR = 未定義のグローバル R4 = 未定義のグローバル R5 = 未定義のグローバル R7 = 未定義のグローバル R8 = 未定義のグローバル RC = 未定義のグローバル RD = 未定義のグローバル R_ = 未定義グローバル st = 未定義
Enter キーを押して終了します: global _ main_t = 未定義のグローバル aaaat = 未定義のグローバル aabat = 未定義のグローバル aacat = 未定義のグローバル akcat = 未定義のグローバル bbbt = 未定義のグローバル ako = 未定義のグローバル ret = 未定義のグローバル operatorRS = 未定義のグローバル sysR = 未定義のグローバル pyreadline.unicode_helperR = 未定義のグローバル モジュールR = 未定義のグローバルexceptionst = 未定義のグローバル ExceptionR = 未定義のグローバル pyreadline.loggerR = 未定義のグローバル FalseR9 = 未定義のグローバル objectR = 未定義のグローバル RLR = 未定義のグローバル history.pys = 未定義のグローバル モジュール = 未定義 71 IOError を除く: 72 self.history = [] 73 self.history_cursor = 0 74 75 def write_history_file(self, filename=None): 76 '''readline 履歴ファイルを保存します。''' 77 if filename is None: 78 filename=self.history_filename 79 fp = open(filename, 'wb' ) 80 self.history[-self.history_length:]: 81 fp.write(ensure_str(line.get_line_text())) 82 fp.write('\n') 83 fp.close() 84 85) 80 self.history[-self.history_length:]: 81 fp.write(ensure_str(line.get_line_text())) 82 fp.write('\n') 83 fp.close() 84 85) 80 self.history[-self.history_length:]: 81 fp.write(ensure_str(line.get_line_text())) 82 fp.write('\n') 83 fp.close() 84 85
C:\Python25\lib\site-packages\pyreadline\unicode_helper.pyc in ensure_unicode(text='import sys') 5 # BSD ライセンスの条項に基づいて配布されます。完全なライセンスは、このソフトウェアの一部として配布される 6 # COPYING ファイルにあります。7
** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * *
8 import sys 9 10 try: 11 pyreadline_codepage=sys.stdout.encoding 12 except AttributeError: #This error occurs when pdb imports readline and doctest has replaced 13 #stdout with stdout collector 14 pyreadline_codepage="ascii" #assume
ascii codepage 15 16 17 def ensure_unicode(text): 18 """WriteConsoleW に渡されたテキストが unicode であることを保証するヘルパー""" 19 if isinstance(text, str): ---> 20 return text.decode(pyreadline_codepage, " replace") 21 return text 22 23 def ensure_str(text): 24 """pyreadline_codepage を使用して Unicode を str に変換""" 25 if isinstance(text, unicode): 26 return text.encode(pyreadline_codepage, "replace") 27 returnテキスト 28 29 30 31 32 33 34 35
TypeError:decode() 引数 1 は None ではなく文字列でなければなりません
おっと、IPython がクラッシュしました。安定させるために最善を尽くしますが...
次の情報を含むクラッシュ レポートが自動的に生成されました。 - クラッシュ トレースバックの逐語的なコピー。- このセッションでの入力履歴のコピー。- 現在の IPython 構成に関するデータ。
「C:\Home_ipython\IPython_crash_report.txt」という名前のファイルに残されていました。このファイルを開発者に電子メールで送信できる場合は、その中の情報が問題の理解と修正に役立ちます。
これは、Fernando Perez (fperez....@gmail.com) にメールで送信できます。件名は「IPython Crash Report」です。
今すぐ実行したい場合は、次のコマンドが機能します (Unix 環境で): mail -s 'IPython Crash Report' fperez....@gmail.com < C:\Home_ipython \IPython_crash_report.txt
この問題を正確に追跡するには、 https ://bugs.launchpad.net/ipython/+filebug でレポートを提出してください。