diff --git a/transport/__init__.py b/transport/__init__.py index 41ba63a..2502240 100644 --- a/transport/__init__.py +++ b/transport/__init__.py @@ -91,7 +91,7 @@ class factory : anObject = eval( aClassName) #setattr(anObject,'name',source) except Exception as e: - print ['Error ',e] + print(['Error ',e]) return anObject # class Reader: diff --git a/transport/common.py b/transport/common.py index 993a961..e49fbdb 100644 --- a/transport/common.py +++ b/transport/common.py @@ -39,7 +39,7 @@ class Reader: """ m = {',':[],'\t':[],'|':[],'\x3A':[]} - delim = m.keys() + delim = list(m.keys()) for row in sample: for xchar in delim: if row.split(xchar) > 1: @@ -53,9 +53,9 @@ class Reader: # The delimiter with the smallest variance, provided the mean is greater than 1 # This would be troublesome if there many broken records sampled # - m = {id: np.var(m[id]) for id in m.keys() if m[id] != [] and int(np.mean(m[id]))>1} - index = m.values().index( min(m.values())) - xchar = m.keys()[index] + m = {id: np.var(m[id]) for id in list(m.keys()) if m[id] != [] and int(np.mean(m[id]))>1} + index = list(m.values()).index( min(m.values())) + xchar = list(m.keys())[index] return xchar def col_count(self,sample): @@ -76,8 +76,8 @@ class Reader: m[id] = 0 m[id] = m[id] + 1 - index = m.values().index( max(m.values()) ) - ncols = int(m.keys()[index]) + index = list(m.values()).index( max(m.values()) ) + ncols = int(list(m.keys())[index]) return ncols; diff --git a/transport/queue.py b/transport/queue.py index 0b5228c..eccde1e 100644 --- a/transport/queue.py +++ b/transport/queue.py @@ -175,7 +175,7 @@ class QueueReader(MessageQueue,Reader): # We enabled the reader to be able to read from several queues (sequentially for now) # The qid parameter will be an array of queues the reader will be reading from # - if isinstance(self.qid,basestring) : + if isinstance(self.qid,str) : self.qid = [self.qid] for qid in self.qid: self.init(qid)