cancel
Showing results for 
Search instead for 
Did you mean: 

(<class 'pywintypes.com_error'>, com_error(-2147352567 while running the code

rusdianzzah-888
Newcomer
0 Kudos

i have the error  when running the code:

(<class 'pywintypes.com_error'>, com_error(-2147352567, 'Exception occurred.', (614, 'saplogon', 'The enumerator of the collection cannot find en element with the specified index.', 'C:\\Program Files (x86)\\SAP\\FrontEnd\\SAPgui\\saplogon.HLP', 393215, 0), None), <traceback object at 0x00000207D0AE5880>)

but this error does not appear all the time. Sometimes the code works, sometimes it doesn't work

this is the code:

     def __init__(self, path: str😞
        subprocess.Popen(path)
        time.sleep(10)

        self.sap_gui = win32com.client.GetObject('SAPGUI')
        if not type(self.sap_gui) == win32com.client.CDispatch:
            return

        self.application = self.sap_gui.GetScriptingEngine

    def login(self, connection: str, user: str, password: str😞
        try:
            self.connection = self.application.OpenConnection(connection, True)
            time.sleep(10)
            self.session = self.connection.Children(0)
            self.session.findById('wnd[0]').maximize

            self.session.findById('wnd[0]/usr/txtRSYST-BNAME').text = user
            self.session.findById('wnd[0]/usr/pwdRSYST-BCODE').text = password
            self.session.findById('wnd[0]').sendVKey(0)
        except :
            self.check_error = 1
            endpoint.inputEndpointLogFailed("sap_zfiaraging","Gagal login", 500, sys.exc_info())
            print(sys.exc_info())

Accepted Solutions (0)

Answers (0)