From e56992e8e0ef197974932cf3849f3e2fab7281df Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 27 Mar 2016 19:20:27 +0200 Subject: Make the code a bit more python3-compliant --- mat | 2 +- mat-gui | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mat b/mat index 64dccc4..0139803 100755 --- a/mat +++ b/mat @@ -52,7 +52,7 @@ def list_meta(class_file, filename, add2archive): print ('Harmful metadata found:') meta = class_file.get_meta() if meta: - for key, value in class_file.get_meta().iteritems(): + for key, value in class_file.get_meta().items(): print('\t%s: %s' % (key, value)) return 0 diff --git a/mat-gui b/mat-gui index 430641a..feccbd2 100755 --- a/mat-gui +++ b/mat-gui @@ -13,7 +13,11 @@ import logging import os import sys import xml.sax -import urllib2 + +try: + from urllib2 import unquote +except ImportError: # python3 + from urllib.parse import unquote from libmat import mat from libmat import strippers @@ -168,7 +172,7 @@ class GUI(object): metadataPopupListStore.append([_('No metadata found'), '']) else: self.liststore[row][2] = _('Dirty') - for i, j in self.liststore[row][0].file.get_meta().iteritems(): + for i, j in self.liststore[row][0].file.get_meta().items(): metadataPopupListStore.append([i, j]) popup_metadata = self.builder.get_object('MetadataPopup') @@ -260,7 +264,7 @@ non-anonymised) file from output archive')) """ Since the dragged urls are ugly, we need to process them """ - url = urllib2.unquote(url) # unquote url + url = unquote(url) # unquote url url = url.decode('utf-8') # decode in utf-8 if url.startswith('file:\\\\\\'): # windows return url[8:] # 8 is len('file:///') -- cgit v1.3