Issue #46 new

debug flag generates error due to attribut tags

Anonymous created an issue

I am on Ubuntu 12.10 with Python 2.7 but I think is a general issue. Hachoir subfile version 0.5.3 hachoir-core version 1.3.3

When you run: hachoir-subfile --debug namefile You will get things like:

  File "/usr/local/bin/hachoir-subfile", line 53, in displaySearchStat
    for parser, stats in subfile.stats.iteritems() ]
AttributeError: type object 'PngFile' has no attribute 'tags'

Comments (1)

  1. Paolo Di Prodi

    Guys is me again, I have fixed it by inspecting the object... the correct code is here:

    def displaySearchStat(subfile):
        stats = [ (parser.PARSER_TAGS['id'], stats[0], stats[1])
            for parser, stats in subfile.stats.iteritems() ]
        print
        print "[ Match statistics ]"
    
        total_hit = 0
        total_valid = 0
        if stats:
            stats.sort(key=lambda values: values[1])
            for parser_id, hit, valid in stats:
                print " - %s: %u hit/%u valid" % (parser_id, hit, valid)
                total_hit += hit
                total_valid += valid
            print
        else:
            print "(no match)"
        print "Total: %u hit/%u valid" % (total_hit, total_valid)
    

    Probably I am violating encapsulation but you know better than me how to integrate the patch. Very nice project by the way!

  2. Log in to comment