我試圖使用IPython demo模式。我創建了一個名爲test.py
文件,其中包含:IPython演示模式
print 1
print 2
print 3
,然後啓動IPython的,也做了以下內容:
In [1]: from IPython.demo import LineDemo
In [2]: d = LineDemo('test.py')
In [3]: d()
********************* <test.py> block # 0 (5 remaining) *********************
p
********************************** output: **********************************
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/Users/tom/Library/Python/2.6/site-packages/ipython-0.10-py2.6.egg/IPython/demo.pyc in runlines(self, source)
400 """Execute a string with one or more lines of code"""
401
--> 402 exec source in self.user_ns
403
404 def __call__(self,index=None):
/Users/tom/tmp/<string> in <module>()
----> 1
2
3
4
5
NameError: name 'p' is not defined
什麼是可能會造成這個錯誤?我是否錯誤地使用LineDemo?
謝謝 - 我會提交一個bug報告 – astrofrog
@Morgoth我只是做:https://bugs.launchpad.net/ipython/+bug/518982 – interjay
哎呀,剛纔看到你必須提交一個bug報告太 – astrofrog