diff --git a/debug.py b/debug.py index d5f86139..7fa169a4 100644 --- a/debug.py +++ b/debug.py @@ -393,7 +393,7 @@ class Profiler: if self.delayed: self.msgs.append(msg2) else: - print msg2 + print(msg2) self.t0 = ptime.time() self.t1 = self.t0 @@ -410,7 +410,7 @@ class Profiler: if self.delayed: self.msgs.append(msg2) else: - print msg2 + print(msg2) self.t1 = ptime.time() ## don't measure time it took to print def finish(self, msg=None): @@ -425,10 +425,10 @@ class Profiler: self.msgs.append(msg) if self.depth == 0: for line in self.msgs: - print line + print(line) Profiler.msgs = [] else: - print msg + print(msg) Profiler.depth = self.depth self.finished = True diff --git a/exporters/SVGExporter.py b/exporters/SVGExporter.py index 70f1f632..587282e0 100644 --- a/exporters/SVGExporter.py +++ b/exporters/SVGExporter.py @@ -220,7 +220,7 @@ def _generateItemSvg(item, nodes=None, root=None): ## get list of sub-groups g2 = [n for n in g1.childNodes if isinstance(n, xml.Element) and n.tagName == 'g'] except: - print doc.toxml() + print(doc.toxml()) raise diff --git a/flowchart/library/Data.py b/flowchart/library/Data.py index 85ab6232..1c612e08 100644 --- a/flowchart/library/Data.py +++ b/flowchart/library/Data.py @@ -236,7 +236,7 @@ class EvalNode(Node): text = fn + "\n".join([" "+l for l in str(self.text.toPlainText()).split('\n')]) + run exec(text) except: - print "Error processing node:", self.name() + print("Error processing node: %s" % self.name()) raise return output diff --git a/functions.py b/functions.py index 00107927..27283631 100644 --- a/functions.py +++ b/functions.py @@ -798,7 +798,7 @@ def makeARGB(data, lut=None, levels=None, scale=None, useRGBA=False): if levels.shape != (data.shape[-1], 2): raise Exception('levels must have shape (data.shape[-1], 2)') else: - print levels + print(levels) raise Exception("levels argument must be 1D or 2D.") #levels = np.array(levels) #if levels.shape == (2,): diff --git a/multiprocess/parallelizer.py b/multiprocess/parallelizer.py index 2d03c000..c805cfdb 100644 --- a/multiprocess/parallelizer.py +++ b/multiprocess/parallelizer.py @@ -19,7 +19,7 @@ class Parallelize(object): for task in tasks: result = processTask(task) results.append(result) - print results + print(results) ## Here is the parallelized version: @@ -30,7 +30,7 @@ class Parallelize(object): for task in tasker: result = processTask(task) tasker.results.append(result) - print results + print(results) The only major caveat is that *result* in the example above must be picklable, diff --git a/multiprocess/processes.py b/multiprocess/processes.py index 1322e78e..1103ef15 100644 --- a/multiprocess/processes.py +++ b/multiprocess/processes.py @@ -232,7 +232,7 @@ class ForkedProcess(RemoteEventHandler): except ClosedError: break except: - print "Error occurred in forked event loop:" + print("Error occurred in forked event loop:") sys.excepthook(*sys.exc_info()) sys.exit(0) @@ -297,7 +297,7 @@ class QtProcess(Process): btn.show() def slot(): - print 'slot invoked on parent process' + print('slot invoked on parent process') btn.clicked.connect(proxy(slot)) # be sure to send a proxy of the slot """ diff --git a/multiprocess/remoteproxy.py b/multiprocess/remoteproxy.py index 94cc6048..887d2e87 100644 --- a/multiprocess/remoteproxy.py +++ b/multiprocess/remoteproxy.py @@ -68,7 +68,7 @@ class RemoteEventHandler(object): try: return cls.handlers[pid] except: - print pid, cls.handlers + print(pid, cls.handlers) raise def getProxyOption(self, opt): @@ -103,7 +103,7 @@ class RemoteEventHandler(object): else: raise except: - print "Error in process %s" % self.name + print("Error in process %s" % self.name) sys.excepthook(*sys.exc_info()) return numProcessed @@ -239,7 +239,7 @@ class RemoteEventHandler(object): self.send(request='result', reqId=reqId, callSync='off', opts=dict(result=result)) def replyError(self, reqId, *exc): - print "error:", self.name, reqId, exc[1] + print("error: %s %s %s" % (self.name, str(reqId), str(exc[1]))) excStr = traceback.format_exception(*exc) try: self.send(request='error', reqId=reqId, callSync='off', opts=dict(exception=exc[1], excString=excStr)) @@ -352,9 +352,9 @@ class RemoteEventHandler(object): try: optStr = pickle.dumps(opts) except: - print "==== Error pickling this object: ====" - print opts - print "=======================================" + print("==== Error pickling this object: ====") + print(opts) + print("=======================================") raise nByteMsgs = 0 @@ -404,12 +404,12 @@ class RemoteEventHandler(object): #print ''.join(result) exc, excStr = result if exc is not None: - print "===== Remote process raised exception on request: =====" - print ''.join(excStr) - print "===== Local Traceback to request follows: =====" + print("===== Remote process raised exception on request: =====") + print(''.join(excStr)) + print("===== Local Traceback to request follows: =====") raise exc else: - print ''.join(excStr) + print(''.join(excStr)) raise Exception("Error getting result. See above for exception from remote process.") else: @@ -535,7 +535,7 @@ class Request(object): raise ClosedError() time.sleep(0.005) if timeout >= 0 and time.time() - start > timeout: - print "Request timed out:", self.description + print("Request timed out: %s" % self.description) import traceback traceback.print_stack() raise NoResultError() diff --git a/opengl/glInfo.py b/opengl/glInfo.py index 95f59630..28da1f69 100644 --- a/opengl/glInfo.py +++ b/opengl/glInfo.py @@ -6,10 +6,10 @@ class GLTest(QtOpenGL.QGLWidget): def __init__(self): QtOpenGL.QGLWidget.__init__(self) self.makeCurrent() - print "GL version:", glGetString(GL_VERSION) - print "MAX_TEXTURE_SIZE:", glGetIntegerv(GL_MAX_TEXTURE_SIZE) - print "MAX_3D_TEXTURE_SIZE:", glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE) - print "Extensions:", glGetString(GL_EXTENSIONS) + print("GL version:" + glGetString(GL_VERSION)) + print("MAX_TEXTURE_SIZE: %d" % glGetIntegerv(GL_MAX_TEXTURE_SIZE)) + print("MAX_3D_TEXTURE_SIZE: %d" % glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE)) + print("Extensions: " + glGetString(GL_EXTENSIONS)) GLTest() diff --git a/reload.py b/reload.py index b9459073..ccf83913 100644 --- a/reload.py +++ b/reload.py @@ -267,14 +267,14 @@ class A(object): object.__init__(self) self.msg = msg def fn(self, pfx = ""): - print pfx+"A class:", self.__class__, id(self.__class__) - print pfx+" %%s: %d" %% self.msg + print(pfx+"A class: %%s %%s" %% (str(self.__class__), str(id(self.__class__)))) + print(pfx+" %%s: %d" %% self.msg) class B(A): def fn(self, pfx=""): - print pfx+"B class:", self.__class__, id(self.__class__) - print pfx+" %%s: %d" %% self.msg - print pfx+" calling superclass.. (%%s)" %% id(A) + print(pfx+"B class:", self.__class__, id(self.__class__)) + print(pfx+" %%s: %d" %% self.msg) + print(pfx+" calling superclass.. (%%s)" %% id(A) ) A.fn(self, " ") """ @@ -294,7 +294,7 @@ class C(A): A.__init__(self, msg + "(init from C)") def fn(): - print "fn: %s" + print("fn: %s") """ open(modFile1, 'w').write(modCode1%(1,1))