To make HasyUtils compliant with Python2 and Pytrhon3, these changes had to be done:
print "..." -> print( "...") print "...", a -> print( "...%s" % a) print "..." % a -> print( "..." % a) print _sys.exc_info()[0] -> print(_sys.exc_info()[0]) print repr(e) -> print( repr( e))tel print "...", -> sys.stdout.write( "...") sys.stdout.flush() except Exception, e: -> except Exception as e u'...' -> '...' a in hsh.keys() -> a in list( hsh.keys()) hsh.has_key( kName) -> kName in hsh import TgUtils -> from . import TgUtils 0777 -> 0o777 izip( a, b) -> list(zip( a, b)) sys.exitfunc = exitHndlr -> atexit.register(exitHndlr) import atexit import thread -> import _thread import __builtin__ -> import builtins from OtherUtils import * -> from HasyUtils.OtherUtils import * hsh.iteritems() -> hsh.items() os.write( fh, 'abc') -> if sys.version.split( '.')[0] == '3': os.write( fh, bytes( 'abc', 'utf-8'))