Skip to Content
Sep 06 at 12:46 PM

[errorCode -2147221020] python scripts connect Sap


Hi, i am using python to operate SAP.

import win32com.client
SapGuiAuto = win32com.client.GetObject("SAPGUI")  # This line happened Error.
application = SapGuiAuto.GetScriptingEngine

The code can be executed successfully on my computer. But occasionally it fails on my friend’s computer.

Error on the second line and Error message is : com_error : (-2147221020, "Invalid syntax", None, None).

I am puzzled. The computer environment of my friend and I are similar. (win10 , SAP740 Python3). Can you give me some suggestions. Any possible reply would be greatly appreciated :)