Pythonのデバッガpdbで複数行のスクリプトを実行しようとすると、そのままだとエラーになる。
(Pdb) if root_task in task_sets['completed']:
*** SyntaxError: unexpected EOF while parsing
こういう時は interact
コマンドを使うとpythonのインタプリタシェルが立ち上がる。
(Pdb) interact
*interactive*
>>> if root_task in task_sets['completed']:
... completed_tasks = task_sets['completed']
... for key in task_sets.keys()
pdbの状態での変数の名前は値を引き継いでいるので、そのまま通常のPythonスクリプトが書ける。
interact
Start an interactive interpreter (using the code module) whose global namespace contains all the (global and local) names found in the current scope.
New in version 3.2.