gedit 'External Tools' plugin hashlib weirdness

Peter Otten __peter__ at
Thu Sep 30 13:54:07 CEST 2010

Joel Hedlund wrote:

> I'm having a weird problem with the 'External Tools' plugin for gedit,
> that seems to get weirder the more I dig into it. When I start gedit
> by clicking a launcher (from the Ubuntu menu, panel or desktop)
> everything is dandy and the 'External Tools' plugin works as expected.
> When gedit is launched from the terminal, the 'External Tools' plugin
> is greyed out in the plugin list and I get this traceback on stderr:
> $ gedit
> Traceback (most recent call last):
>   File "/usr/lib/gedit-2/plugins/externaltools/", line 24,
> in <module>
>     from manager import Manager
>   File "/usr/lib/gedit-2/plugins/externaltools/", line 27,
> in <module>
>     import hashlib
>   File "/usr/lib/python2.6/", line 136, in <module>
>     md5 = __get_builtin_constructor('md5')
>   File "/usr/lib/python2.6/", line 63, in
> __get_builtin_constructor
>     import _md5
> ImportError: No module named _md5
> ** (gedit:8714): WARNING **: Error loading plugin 'External Tools'
> The same thing happens if I try to activate the plugin from a gedit
> launched from the terminal (if it's already been deactivated from a
> gedit launched from the menu).
> My analysis is that gedit tries to import the externaltools package,
> which imports hashlib, which tries to import _hashlib but fails and
> falls back to _md5 which also fails, which apparently /should not
> happen/, or so google tells me. One of _hashlib and _md5 should always
> exist.
> However, importing _hashlib in a python interpreter works just fine,
> i.e:
> $ python -c 'import _hashlib'
> returns nothing. What also puzzles me is that I don't seem to have
> _hashlib* anywhere on my system (am I supposed to?) and getting the
> __file__ attribute off the module doesn't work, and help(_hashlib)
> says FILE is (built-in).
>>>> import _hashlib
>>>> _hashlib.__file__
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute '__file__'
> Google drops vague hints that there may be a a virtualenv that one
> might have to rebuild, but in that case I have no idea where to
> begin.
> I've tried reinstalling the ubuntu packages gedit, gedit-common and
> gedit-plugins, but to no avail. And the machine runs a fully updated
> ubuntu karmic koala (10.4) that has survived numerous dist-upgrades,
> if that's of any use to anybody.
> I'd appreciate any input on this, even if it's just new bushes to
> whack for scaring the problem out into the light.

You could add

import sys
print sys.executable

at the top of 


Maybe there's some confusion about what python interpreter should be used.


More information about the Python-list mailing list