def restart(self):
        self.clean()
        if ArmoryDSession.numInstances != 0:
            raise RuntimeError(
                "Cannot have more than one ArmoryD session simultaneously")

        try:
            self.callArmoryD([
                os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory',
                             FIRST_WLT_FILE_NAME)
            ], False)
            ArmoryDSession.numInstances += 1
            # Wait for Armory_Daemon to start running
            i = 0
            while not Armory_Daemon.checkForAlreadyRunning() and i < 10:
                time.sleep(1)
                i += 1
            if i >= 10:
                raise RuntimeError(
                    "Cannot have more than one ArmoryD session simultaneously")

        except:
            self.clean()
            raise
        self.running = True
   def callArmoryD(self, additionalArgs, waitForOutput=True):
      armoryDArgs = ['python', self.armorydPath,
            '--testnet',
            '--datadir=' + os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory'),
            '--satoshi-datadir=' + os.path.join(self.tiab.tiabDirectory, 'tiab', '1'),
            '--satoshi-port=' + str(TIAB_SATOSHI_PORT),
            '--skip-online-check',
            '--supernode']
            # if this is process is in debug mode, make the subrocess debug too
      if CLI_OPTIONS.doDebug:
         armoryDArgs.append('--debug')

      armoryDArgs.extend(additionalArgs)
      if waitForOutput:
         # We're expecting some json to come back, that means there should
         # already be a daemon running
         if not Armory_Daemon.checkForAlreadyRunning():
            raise RuntimeError("armoryd isn't running")

         # If there is output coming back convert it from a string to a dictionary
         return subprocess.check_output(armoryDArgs)
      else:
         # If we are not waiting output, e.g. when starting ArmoryD, return the started process.
         startedProcess = subprocess.Popen(armoryDArgs)
         self.processes.append(startedProcess)
         return startedProcess
 def restart(self):
    self.clean()
    if ArmoryDSession.numInstances != 0:
       raise RuntimeError("Cannot have more than one ArmoryD session simultaneously")
    
    try:
       self.callArmoryD([os.path.join(self.tiab.tiabDirectory, 'tiab', 'armory',FIRST_WLT_FILE_NAME)], False)
       ArmoryDSession.numInstances += 1
       # Wait for Armory_Daemon to start running
       i = 0
       while not Armory_Daemon.checkForAlreadyRunning() and i < 10:
          time.sleep(1)
          i += 1
       if i >= 10:
          raise RuntimeError("Cannot have more than one ArmoryD session simultaneously")
          
    except:
       self.clean()
       raise
    self.running = True