myMachine=getShortHostName()
Container_path = "/Containers/" + myMachine + "/" + containerName
self._containerName = Container_path
- if verbose(): print "container name ",self._containerName
+ if verbose(): print("container name ",self._containerName)
naming_service = SALOME_NamingServicePy_i(self._orb)
self._naming_service = naming_service
def instance(self, nameToRegister, componentName):
MESSAGE( "SALOME_ContainerPy_i::instance " + str(nameToRegister) + ' ' + str(componentName) )
self._numInstance = self._numInstance +1
- instanceName = nameToRegister + "_inst_" + `self._numInstance`
+ instanceName = nameToRegister + "_inst_" + repr(self._numInstance)
component=__import__(componentName)
factory=getattr(component,componentName)
def load_impl(self, nameToRegister, componentName):
MESSAGE( "SALOME_ContainerPy_i::load_impl " + str(nameToRegister) + ' ' + str(componentName) )
self._numInstance = self._numInstance +1
- instanceName = nameToRegister + "_inst_" + `self._numInstance`
+ instanceName = nameToRegister + "_inst_" + repr(self._numInstance)
interfaceName = nameToRegister
the_command = "import " + nameToRegister + "\n"
the_command = the_command + "comp_i = " + nameToRegister + "." + nameToRegister
the_command = the_command + "(self._orb, self._poa, self._this(), self._containerName, instanceName, interfaceName)\n"
MESSAGE( "SALOME_ContainerPy_i::load_impl :" + str (the_command) )
- exec the_command
+ exec(the_command)
comp_o = comp_i._this()
return comp_o
MESSAGE( "SALOME_Container_i::import_component" )
reason = ""
try:
- if verbose(): print "try import %s" % componentName
+ if verbose(): print("try import %s" % componentName)
# try import component
module=__import__(componentName)
- if verbose(): print "import %s is done successfully" % componentName
+ if verbose(): print("import %s is done successfully" % componentName)
# if import successfully, check that component is loadable
if not hasattr(module, componentName):
reason = "module %s is not loadable" % componentName
- print reason
+ print(reason)
pass
pass
except:
import traceback
- print "cannot import %s" % componentName
+ print("cannot import %s" % componentName)
traceback.print_exc()
reason = "cannot import %s" % componentName
return reason
def load_component_Library(self, componentName):
MESSAGE( "SALOME_ContainerPy_i::load_component_Library " + str(componentName) )
ret = 0
- instanceName = componentName + "_inst_" + `self._numInstance`
+ instanceName = componentName + "_inst_" + repr(self._numInstance)
interfaceName = componentName
reason = self.import_component(componentName)
return reason == "", reason
def create_component_instance(self, componentName):
MESSAGE( "SALOME_ContainerPy_i::create_component_instance ==> " + str(componentName) )
self._numInstance = self._numInstance +1
- instanceName = componentName + "_inst_" + `self._numInstance`
+ instanceName = componentName + "_inst_" + repr(self._numInstance)
comp_iors=""
try:
component=__import__(componentName)
def find_component_instance(self, registeredName):
anEngine = None
- keysList = self._listInstances_map.keys()
+ keysList = list(self._listInstances_map.keys())
i = 0
while i < len(keysList):
instance = keysList[i]
# change the stdout buffering to line buffering (same as C++ cout buffering)
sys.stdout=os.fdopen(1,"w",1)
#initialise the ORB and find the root POA
- if verbose():print "Starting ",sys.argv[1]
+ if verbose():print("Starting ",sys.argv[1])
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
- if verbose():print "ORB and POA initialized"
+ if verbose():print("ORB and POA initialized")
#create an instance of SALOME_ContainerPy_i and a Container reference
#containerName = "FactoryServerPy"
MESSAGE( str(sys.argv) )
containerName = sys.argv[1]
cpy_i = SALOME_ContainerPy_i(orb, poa, containerName)
- if verbose():print "SALOME_ContainerPy_i instance created ",cpy_i
+ if verbose():print("SALOME_ContainerPy_i instance created ",cpy_i)
cpy_o = cpy_i._this()
- if verbose():print "SALOME_ContainerPy_i instance activated ",cpy_o
+ if verbose():print("SALOME_ContainerPy_i instance activated ",cpy_o)
sys.stdout.flush()
sys.stderr.flush()
#Block for ever
orb.run()
- if verbose():print "SALOME_ContainerPy_i shutdown"
+ if verbose():print("SALOME_ContainerPy_i shutdown")