Inkscape and textext: Deprecation Warning
by Pascal Schulthess. Average Reading Time: about a minute.
I just came across the following error of textext in Inkscape.
~/.inkscape/extensions/textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead import os, sys, tempfile, traceback, glob, re, md5, copy |
This error arises for textext 0.4.4., Inkscape 0.46 and Python 2.6.2. Fortunately I found a solution at bitbucket. But since I had some problems understanding how to change the python file, I will help you out with a detailed how-to.
Open the textext.py file mentioned in the error message with an editor of your choice. Now change the the lines
54 55 56 | import inkex import os, sys, tempfile, traceback, glob, re, md5, copy from lxml import etree |
into
54 55 56 57 | import inkex import os, sys, tempfile, traceback, glob, re, copy import hashlib from lxml import etree |
Furthermore change
868 869 870 871 872 873 874 875 876 877 878 | def __init__(self, document): PdfConverterBase.__init__(self, document) self.hash = None def convert(self, *a, **kw): # compute hash for generating unique ids for sub-elements self.hash = md5.new('%s%s' % (a, kw)).hexdigest()[:8] return PdfConverterBase.convert(self, *a, **kw) def pdf_to_svg(self): exec_command(['pdf2svg', self.tmp('pdf'), self.tmp('svg'), '1']) |
into
868 869 870 871 872 873 874 875 876 877 878 879 880 881 | def __init__(self, document): PdfConverterBase.__init__(self, document) self.hash = None USE_GTK = False def convert(self, *a, **kw): # compute hash for generating unique ids for sub-elements m = hashlib.md5() m.update('%s%s' % (a, kw)) self.hash = m.hexdigest()[:8] return PdfConverterBase.convert(self, *a, **kw) def pdf_to_svg(self): exec_command(['pdf2svg', self.tmp('pdf'), self.tmp('svg'), '1']) |
That’s it. Restart Inkscape and you’re done.
Happy TeXing

Thanks! Just what I needed.
awsome! you made my day
btw, just saw that we are in the same field (academically).
Grüße aus Darmstadt !
Thanks a lot. It has cured my lasting headache.
Thanks bud, this worked bootifully!
Thanks! Very helpful.
Awesome. Thanks a million!
Awesome!
I got the error you are describing after fixing the “The fantastic lxml wrapper for libxml2 is required by inkex.py and therefore this extension” with the instructions given in http://caih.org/open-source-software/fixing-inkscape-in-mac-os-x/
This solution works perfectly in Snow Leopard 10.6.3.
Thanks for sharing your wisdom!
I found this textext fixing problem, at it worked.
I spread to others too…
Thanks and Regards
WAS
whoa! thanks a lot. this is why I love open source software
Many thanks, you saved me.
[...] you need to update your textext files, thanks to Pascal Schulthess for the [...]
Doesn’t seam to work for Windows 7. When editing with Jedit I get a java.io.FileNotFoundException even after enabling all privileges for texttex.py,texttext.inx, and C:\Program Files (x86)\Inkscape\share\extensions.
Thanks a lot man!!