Issue #1 resolved

Module md5 deprecated in Python >= 2.6

pv
repo owner created an issue

Should use hashlib.

Comments (19)

  1. Anonymous

    I did the following changes and it seems to work for my Python 2.6.2rc1

    @@ -52,7 +52,8 @@ sys.path.append(os.path.dirname(file))

    import inkex -import os, sys, tempfile, traceback, glob, re, md5, copy +import os, sys, tempfile, traceback, glob, re, copy +import hashlib from lxml import etree

    USE_GTK = False @@ -871,7 +872,9 @@

    def convert(self, *a, kw):

    1. compute hash for generating unique ids for sub-elements - self.hash = md5.new('%s%s' % (a, kw)).hexdigest()[:8] + 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):

  2. Anonymous

    You need to change the python file. If you don't read diffs in the text, here's how it works :

    if you read - old line + newline1 + newline2 means that you have to change "old line" into "newline1" and "newline2"

  3. Anonymous

    note that kw is indeed * *kw (without space between the two *s) so it doesn't need to be changed. Worked for me too.

  4. Anonymous

    Reposting the patch without the nasty HTML interpretation (at least in preview it looks good):

    --- textext.py~	2008-10-04 06:46:02.000000000 -0400
    +++ textext.py	2009-08-25 15:57:30.527900000 -0400
    @@ -52,7 +52,8 @@
     sys.path.append(os.path.dirname(__file__))
     
     import inkex
    -import os, sys, tempfile, traceback, glob, re, md5, copy
    +import os, sys, tempfile, traceback, glob, re, copy
    +import hashlib
     from lxml import etree
     
     USE_GTK = False
    @@ -871,7 +872,9 @@
     
         def convert(self, *a, **kw):
             # compute hash for generating unique ids for sub-elements
    -        self.hash = md5.new('%s%s' % (a, kw)).hexdigest()[:8]
    +        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):
    

    Thanks, anonymous author.

  5. Anonymous

    hi guys! i believe i have conducted the required changes to "textext.py" but now get the error:

      File "textext.py", line 878
      return PdfConverterBase.convert(self, *a, **kw)
                               ^
    IndentationError: unindent does not match any outer indentation level
    

    any idea what that might be?

    Thanks!

  6. Anonymous

    Hi,

    I got the following error, after replacing the lines above:

    File "textext.py", line 876
    
        m.update('%s%s' % (a, kw))
    
        ^
    
    IndentationError: unexpected indent
    
  7. Anonymous

    If you're getting indent errors, you may need to change your Tabs to spaces - for example, in Notepad++, the preferences menu will let you replace a tab with n-spaces.

  8. Log in to comment