def __init__(self, io, _startcount=2): """ initialize core gateway, using the given inputoutput object. """ self._io = io self._channelfactory = ChannelFactory(self, _startcount) self._cleanup.register(self) if _startcount == 1: # only import 'py' on the "client" side import py self.hook = py._com.HookRelay(ExecnetAPI, py._com.comregistry) else: self.hook = ExecnetAPI()