這裏是我行動的IPython:是否可以在IPython中通過調試來運行命令?
> import my_module
> import ipdb
現在,我的模塊沒有任何可執行代碼,它只是聲明類。所以我想發表一個聲明:
> g = my_module.Graph()
> f = open('test.osm')
> g.from_osm(f)
我想在Graph.from_osm裏放一個斷點,不用編輯文件。我不想把後面的行放到文件中,並且要做python -m ipdb ...
。我只想運行命令和調試。
這可能嗎?
補充說:我看,有可能
%run -d script_name
或
> import pdb
> pdb.run('statement')
但它不可能做ipdb.run('statement')
,有一個在ipdb
沒有.run
!
在ipdb 0.8中有一個'.run'。 – gerrit 2014-04-04 13:00:47
[步入IPython中的函數]的可能的重複(http://stackoverflow.com/questions/12646670/stepping-into-a-function-in-ipython) – LondonRob 2015-03-05 17:20:09