hello everyone , I'm new in using pyfluent ,I've created this code from a YouTube video
concerning the utilization of pyfluent .
the code works perfectly until the line when Fluent should switch to solution mode. its gives me this error 
the code I have written is below
import ansys.fluent.core as pyfluent
meshing_session = pyfluent.launch_fluent(precision="double", processor_count=2, mode ="meshing" ,show_gui=True)
workflow=meshing_session.workflow
meshing=meshing_session.meshing
workflow.InitializeWorkflow(WorkflowType=r'Fault-tolerant Meshing')
workflow.InitializeWorkflow(WorkflowType=r'Watertight Geometry')
meshing.GlobalSettings.LengthUnit.set_state(r'mm')
meshing.GlobalSettings.AreaUnit.set_state(r'mm^2')
meshing.GlobalSettings.VolumeUnit.set_state(r'mm^3')
workflow.TaskObject['Import Geometry'].Arguments.set_state({r'FileName': r'C:/Users/DELL/Desktop/Fluent ANSYS/Static Mixer geometry.dsco',})
workflow.TaskObject['Import Geometry'].Execute()
workflow.TaskObject['Add Local Sizing'].AddChildAndUpdate()
workflow.TaskObject['Generate the Surface Mesh'].Execute()
workflow.TaskObject['Describe Geometry'].UpdateChildTasks(SetupTypeChanged=False)
workflow.TaskObject['Describe Geometry'].Arguments.set_state({r'SetupType': r'The geometry consists of only fluid regions with no voids',})
workflow.TaskObject['Describe Geometry'].UpdateChildTasks(SetupTypeChanged=True)
workflow.TaskObject['Describe Geometry'].Execute()
workflow.TaskObject['Update Boundaries'].Execute()
workflow.TaskObject['Update Regions'].Execute()
workflow.TaskObject['Add Boundary Layers'].AddChildAndUpdate()
workflow.TaskObject['Generate the Volume Mesh'].Execute()
meshing.excute_tui(r'''/switch-to-solution-mode''')
solver.execute_tui(r'''(newline)''')
solver.setup.models.energy = {"enabled" : True}
solver.tui.define.materials.copy('fluid', 'water-liquid')
solver.setup.cell_zone_conditions.fluid['fluid'] = {"material" : "water-liquid"}
solver.setup.boundary_conditions.velocity_inlet['velocity-inlet-1'] = {"vmag" : 0.}
solver.setup.boundary_conditions.velocity_inlet['velocity-inlet-1'] = {"vmag" : 0.}
solver.setup.boundary_conditions.velocity_inlet['velocity-inlet-2'] = {"vmag" : 1.}
solver.setup.boundary_conditions.velocity_inlet['velocity-inlet-2'] = {"vmag" : 1.}
solver.solution.initialization.hybrid_initialize()
solver.solution.run_calculation.iterate(iter_count = 20)
solver.exit()