diff --git a/pykat/commands.py b/pykat/commands.py index 8300b1805ec06a2ac5691e1e0d8c0f3bfd86111a..bd21e8ce16d7d910f78212a8c5df42c65be9ab33 100644 --- a/pykat/commands.py +++ b/pykat/commands.py @@ -4,9 +4,12 @@ Created on Mon Jan 28 11:58:09 2013 @author: Daniel """ +from __future__ import print_function import numpy from numpy import min,max -import exceptions +import pykat.external.six as six +if six.PY2: + import exceptions from components import * from structs import * from pykat.param import Param, putter diff --git a/pykat/components.py b/pykat/components.py index f6b5e83d6e80325fb8a6b7dbe2073fce55df90d0..99c8cdbd4ea36b3955afcb99b2e76631effc1b30 100644 --- a/pykat/components.py +++ b/pykat/components.py @@ -4,7 +4,10 @@ Created on Mon Jan 28 11:10:01 2013 @author: Daniel """ -import exceptions +from __future__ import print_function +import pykat.external.six as six +if six.PY2: + import exceptions import pykat.exceptions as pkex import pykat from pykat.node_network import * diff --git a/pykat/detectors.py b/pykat/detectors.py index 1726b30f8b97f59ed27f9e002c06dac41c95179d..612b01c48f2765e976e894c6f8d83fba76633dc7 100644 --- a/pykat/detectors.py +++ b/pykat/detectors.py @@ -4,7 +4,10 @@ Created on Fri Feb 01 0split()9:09:10 2013 @author: Daniel """ -import exceptions +from __future__ import print_function +import pykat.external.six as six +if six.PY2: + import exceptions import abc from pykat.node_network import * from pykat.param import Param @@ -878,4 +881,4 @@ class qhd(Detector2): for p in self._params: rtn.extend(p.getFinesseText()) - return rtn \ No newline at end of file + return rtn diff --git a/pykat/exceptions.py b/pykat/exceptions.py index c1f620be084d1e200c3f0c14a8edafc77e565ccf..e3d904276bb18c7b9eeb50f071340305b80e9611 100644 --- a/pykat/exceptions.py +++ b/pykat/exceptions.py @@ -1,4 +1,7 @@ -import exceptions +from __future__ import print_function +import pykat.external.six as six +if six.PY2: + import exceptions import os class BasePyKatException(Exception): diff --git a/pykat/gui/graphics.py b/pykat/gui/graphics.py index 35430023596fc62c7ea3fd4262eb02cb3e5952bd..84618b3d65b7f24f8bdc135bd99ee3b1ade110e8 100644 --- a/pykat/gui/graphics.py +++ b/pykat/gui/graphics.py @@ -5,12 +5,15 @@ Created on Fri Feb 01 09:13:03 2013 @author: Daniel """ +from __future__ import print_function +import pykat.external.six as six +if six.PY2: + import exceptions from PyQt4.QtGui import * from PyQt4.Qt import * from PyQt4 import QtSvg from PyQt4.QtSvg import QGraphicsSvgItem import pykat.components -import exceptions import weakref nsize = 10 diff --git a/pykat/node_network.py b/pykat/node_network.py index 0db121648421a08f63a326b2f2de0f4b4a990412..115c2b933b150826e80b22890d8dc0b6b432e7bf 100644 --- a/pykat/node_network.py +++ b/pykat/node_network.py @@ -4,7 +4,7 @@ Created on Sun Jan 27 10:02:41 2013 @author: Daniel """ - +from __future__ import print_function from pykat import USE_GUI, NoGUIException if USE_GUI: @@ -349,7 +349,7 @@ class NodeNetwork(object): return False elif isinstance(currcomp, pykat.components.isolator): - print "isol" + print("isol") elif isinstance(currcomp, pykat.components.laser): # if we are at a laser then we can't go any further # and it isn;t this node as we checked before diff --git a/pykat/param.py b/pykat/param.py index 31fe7c36839d30d32e0db1946062aa94ceda8d8e..590fbf5f160b1ddf0df847fbb74f5a51c306926a 100644 --- a/pykat/param.py +++ b/pykat/param.py @@ -1,3 +1,4 @@ +from __future__ import print_function import abc import pykat.exceptions as pkex import weakref @@ -150,7 +151,7 @@ class Param(putable, putter): #if this param can be put somewhere we need to check if it is if self.isPutable: for a in self.putees: - print "Removing put from {0} {1} to {2} {3}".format(self.owner.name, self.name, a.owner.name, a.name) + print("Removing put from {0} {1} to {2} {3}".format(self.owner.name, self.name, a.owner.name, a.name)) a._putter = None self.put_count -= 1 @@ -160,7 +161,7 @@ class Param(putable, putter): # check if we have anything being put to us if self.isPutter: if self._putter != None: - print "Removing put from {0} {1} to {2} {3}".format(self._putter.owner.name, self._putter.name, self.owner.name, self.name) + print("Removing put from {0} {1} to {2} {3}".format(self._putter.owner.name, self._putter.name, self.owner.name, self.name)) self._putter.put_count -= 1 self._putter.putees.remove(self) self._putter = None