break
        else:
            consecutiveRunCounter += 1
            if consecutiveRunCounter >= maxNumberOfConsecutiveRuns:
                relaunch = True
                break

#     print 'allowRelaunch=',allowRelaunch,' relaunch=',relaunch

    if allowRelaunch and relaunch:

        from ParameterScanUtils import getParameterScanCommandLineArgList
        from SystemUtils import getCC3DRunScriptPath

        popenArgs = [getCC3DRunScriptPath()
                     ] + getParameterScanCommandLineArgList(fileName)
        # print 'popenArgs=',popenArgs

        #         print 'WILL RESTART RUN SCRIPT FOR PARAMETER SCAN'
        #         import time
        #         time.sleep(5)

        from subprocess import Popen
        cc3dProcess = Popen(popenArgs)

except IndentationError, e:
    if CompuCellSetup.simulationObjectsCreated:
        sim.finish()
    traceback_message = traceback.format_exc()
    print traceback_message
    print "Indentation Error" + e.message
        # jumping out of the loop when running single simulation. Will stay in the loop for e.g. parameter scan 
        if singleSimulation:
            break
        else:
            consecutiveRunCounter += 1
            if consecutiveRunCounter >= maxNumberOfConsecutiveRuns:
                relaunch = True
                break

                #     print 'allowRelaunch=',allowRelaunch,' relaunch=',relaunch

    if allowRelaunch and relaunch:
        from ParameterScanUtils import getParameterScanCommandLineArgList
        from SystemUtils import getCC3DRunScriptPath

        popenArgs = [getCC3DRunScriptPath()] + getParameterScanCommandLineArgList(fileName)
        # print 'popenArgs=',popenArgs

        #         print 'WILL RESTART RUN SCRIPT FOR PARAMETER SCAN'
        #         import time
        #         time.sleep(5)

        from subprocess import Popen

        cc3dProcess = Popen(popenArgs)



except (IndentationError, SyntaxError, IOError, ImportError, NameError) as e:
    if CompuCellSetup.simulationObjectsCreated:
        sim.finish()
        # jumping out of the loop when running single simulation. Will stay in the loop for e.g. parameter scan 
        if singleSimulation:
            break
        else:
            consecutiveRunCounter += 1
            if consecutiveRunCounter >= maxNumberOfConsecutiveRuns:
                relaunch = True
                break

                #     print 'allowRelaunch=',allowRelaunch,' relaunch=',relaunch

    if allowRelaunch and relaunch:
        from ParameterScanUtils import getParameterScanCommandLineArgList
        from SystemUtils import getCC3DRunScriptPath

        popenArgs = [getCC3DRunScriptPath()] + getParameterScanCommandLineArgList(fileName)
        # print 'popenArgs=',popenArgs

        #         print 'WILL RESTART RUN SCRIPT FOR PARAMETER SCAN'
        #         import time
        #         time.sleep(5)

        from subprocess import Popen

        cc3dProcess = Popen(popenArgs)



except (IndentationError, SyntaxError, IOError, ImportError, NameError) as e:
    if CompuCellSetup.simulationObjectsCreated:
        sim.finish()