Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

[errorCode -2147221020] python scripts connect Sap

0 Likes
2,480

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 🙂

3 REPLIES 3
Read only

former_member751591
Participant
0 Likes
2,127

Welcome to the SAP Community! We wanted to give you the opportunity to take the tutorial to get started in SAP Community, as it provides tips for preparing questions that draw responses from our members.

Additionally, by adding a picture to your profile you encourage readers to respond to your question. Learn more about your profile using Profile Tutorial

Thank you!

Read only

2,127

If my problem description is very simple, I am sorry.

But i have found the reason. The start permissions of SAP and python are different, resulting in an error. They should have the same authority, such as administrator authority or standard user authority.

Read only

2,127

If my problem description is very simple, sorry.

But I found the reason: the startup permissions of sap and python are not the same.

For example, both of these should be run with administrator rights, or run with ordinary user rights.