Whenever I try to launch 'hotot' I get this errors. This error also appears if i try something stupid in terminal along with "No Module named gdm"

 Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 64, in    apport_excepthook
  from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python2.7/dist-packages/apport/__init__.py", line 1, in <module>
 from apport.report import Report
File "/usr/lib/python2.7/dist-packages/apport/report.py", line 16, in <module>
 from xml.parsers.expat import ExpatError
File "/usr/lib/python2.7/xml/parsers/expat.py", line 4, in <module>
 from pyexpat import *
ImportError: No module named pyexpat

I am on Ubuntu 12.04 python 2.7.3. I found similar problem here https://github.com/Kindari/SublimeXdebug/issues/5 but did not work.

as asked below I am inserting this too

ls  /usr/lib/python2.7/lib-dynload/
audioop.so  _codecs_cn.so       _codecs_jp.so  crypt.so    _ctypes_test.so         _elementtree.so  _io.so      _multibytecodec.so   _sqlite3.so
_bsddb.so   _codecs_hk.so       _codecs_kr.so  _csv.so     _curses_panel.so   _heapq.so        _json.so    _multiprocessing.so  _testcapi.so
  bz2.so      _codecs_iso2022.so  _codecs_tw.so  _ctypes.so  _curses.so          _hotshot.so      _lsprof.so  Python-2.7.egg-info
  • Can you include the output of ls -l /usr/lib/python2.7/*/pyexpat* in your question? – phihag Jul 10 '12 at 7:41
  • It says: No such file or directory. – Chandan Gupta Jul 10 '12 at 8:28
  • One more thing: On which architecture and Ubuntu version are you? I can't reproduce the problem with a stock Ubuntu 12.04 amd64 Desktop. – phihag Jul 10 '12 at 11:49
  • Linux 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux – Chandan Gupta Jul 10 '12 at 12:40

Your installation of python2.7 has been damaged; it should contain /usr/lib/python2.7/lib-dynload/pyexpat.so. The most likely cause is a misbehaving program, or a hard disk failure.

You can reinstall python2.7 with the following command:

sudo apt-get install --reinstall python2.7
| improve this answer | |
  • seriously I never ever ever imagined this could have been due to a hardware failure. reinstalling did the job. But still if I type some stupid command I don't get error "command not found" but rather I get "No Module Named gdbm" . It shows error with CommnadNotFound.py . I would be glad if you could help me fixing that too!. Thanks a lot – Chandan Gupta Jul 10 '12 at 15:41
  • 1
    That looks like you need to reinstall python-gdbm as well. – phihag Jul 10 '12 at 16:01
  • you are a lifesafer :) – Chandan Gupta Jul 10 '12 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.