[Tutor] Ipython console
Peter Otten
__peter__ at web.de
Mon May 2 09:09:41 CEST 2011
Mateusz Koryciński wrote:
> Hi,
>
> I am using ipython console on one of servers and it's great. Because of
> that I've tried to install it on my laptop, but unfortunately I am getting
> this error:
>
> Traceback (most recent call last):
>> File "/usr/bin/ipython", line 26, in <module>
>> import IPython.Shell
>> File "/usr/lib/python2.7/dist-packages/IPython/__init__.py", line 58,
>> in
>> <module>
>> __import__(name,glob,loc,[])
>> File "/usr/lib/python2.7/dist-packages/IPython/ipstruct.py", line 17,
>> in
>> <module>
>> from IPython.genutils import list2dict2
>> File "/usr/lib/python2.7/dist-packages/IPython/genutils.py", line 20,
>> in
>> <module>
>> import doctest
>> File "/usr/lib/python2.7/doctest.py", line 329, in <module>
>> class _OutputRedirectingPdb(pdb.Pdb):
>> AttributeError: 'module' object has no attribute 'Pdb'
>>
>
> I know it means that Ipython missing some methods / objects, but I don't
> know what should I install additionally. I am using Ubuntu so I've
> installed Ipython from repo.
Installing from "repo" means that Ubuntu should automatically install
IPython's dependencies. Furthermore pdb is part of the standard library:
http://docs.python.org/library/pdb.html
Therefore I'd guess that you have called one of your own Python modules
"pdb.py" which shades the Python debugger. You should be OK if you remove
that (and the associated pyc file). Here's a demo (using 2.6):
$ python -c 'import IPython.Shell'
$ touch pdb.py # create an empty pdb module in the working directory
$ python -c 'import IPython.Shell'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/pymodules/python2.6/IPython/__init__.py", line 58, in
<module>
__import__(name,glob,loc,[])
File "/usr/lib/pymodules/python2.6/IPython/ipstruct.py", line 17, in
<module>
from IPython.genutils import list2dict2
File "/usr/lib/pymodules/python2.6/IPython/genutils.py", line 20, in
<module>
import doctest
File "/usr/lib/python2.6/doctest.py", line 318, in <module>
class _OutputRedirectingPdb(pdb.Pdb):
AttributeError: 'module' object has no attribute 'Pdb'
$ rm pdb.py pdb.pyc # remove the empty pdb module
$ python -c 'import IPython.Shell'
More information about the Tutor
mailing list