File not found or could not be opened for reading

I follow the given sample code.When I am trying to load one module to the real controller , it returns the error : RobotStudio .NET exception:  File not found or could not be opened for reading. However , the  module does exist . Here is  my code , any idea? I am a green hand ,thanks a lot !

private static void button_ExecuteCommandSecond(object sender, ExecuteCommandEventArgs e)
            // Step 1: Connect to the controller
            #region LMStep1
            Guid systemId = new Guid("7fa807ce-c383-42b6-8a32-549fcb4cb50d");
            Controller controller = new Controller(systemId);

            // Clears the eventlogs in the controller

            // Gets the task with the specified name.
            ABB.Robotics.Controllers.RapidDomain.Task tRob1 = controller.Rapid.GetTask("T_ROB1");

            // Step 2: Select module from PC
            #region LMStep2
            if (System.IO.File.Exists(@D:\Temp\MyModule.mod))
                    string ModulefilePath = @D:\Temp\MyModule.mod;
                    bool bLoadModuleSuccess = false;

                    // Step 3: Load Module 
                    #region LMStep3
                    using (Mastership.Request(controller.Rapid))
                        // Loads a RAPID module to the task in the robot controller.
                        Logger.AddMessage("The mastership has been gotten.");
                        bLoadModuleSuccess = tRob1.LoadModuleFromFile(ModulefilePath, RapidLoadMode.Replace);      // According to the report ,here happens the error.


Sign In or Register to comment.