AppStartError: CreateProcess: The system cannot find the file specified
AppStartError: CreateProcess: The system cannot find the file specified
使用 pywinauto 自动化 SAP 提取。我发誓这段代码——直接从 SWAPY 中复制——昨天有效。
from pywinauto.application import Application
app = Application().Start(cmd_line = u"C:\'Program Files (x86)'\SAP\FrontEnd\SAPgui\saplogon.exe")
window = app.Dialog
window.Wait('ready')
edit = window.Edit
edit.ClickInput()
这给了我以下错误:
error:
Traceback (most recent call last)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pywinauto\application.py
in start(self, cmd_line, timeout, retry_interval, create_new_console,
wait_for_idle, work_dir)
991 work_dir, # If None - use parent's starting directory.
--> 992 start_info) # STARTUPINFO structure.
993 except Exception as exc:
error: (2, 'CreateProcess', 'The system cannot find the file
specified.')
During handling of the above exception, another exception occurred:
AppStartError Traceback (most recent call
last) in ()
1 from pywinauto.application import Application
2
----> 3 app = Application().Start(cmd_line=u"C:\'Program Files (x86)''\SAP\FrontEnd\SAPgui\saplogon.exe")
4 window = app.Dialog
5 window.Wait('ready')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pywinauto\application.py
in start(self, cmd_line, timeout, retry_interval, create_new_console,
wait_for_idle, work_dir)
995 message = ('Could not create the process "%s"\n'
996 'Error returned by CreateProcess: %s') % (cmd_line, str(exc))
--> 997 raise AppStartError(message)
998
999 self.process = dw_process_id
AppStartError: Could not create the process "C:\'Program Files
(x86)''\SAP\FrontEnd\SAPgui\saplogon.exe" Error returned by
CreateProcess: (2, 'CreateProcess', 'The system cannot find the file
specified.')
我是 运行 Win7 64 位 Python 3.6.4 :: Anaconda 自定义(64 位)和 pywingui 版本 222。我可以将命令剪切并粘贴到 cmd window 并且它启动应用程序就好了。
我已经更改了引号。我将字符串更改为原始字符串并删除了单个 \
的 \
我很生气。
此外 - 昨天 "worked",在 740 版本的 SAP GUI 中单击元素是一个真正的挑战。有什么技巧可以克服他们混淆用户界面的方法吗?
将 u"C:\'Program Files (x86)'\SAP\FrontEnd\SAPgui\saplogon.exe"
更改为 r'C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe'
解决了问题
使用 pywinauto 自动化 SAP 提取。我发誓这段代码——直接从 SWAPY 中复制——昨天有效。
from pywinauto.application import Application
app = Application().Start(cmd_line = u"C:\'Program Files (x86)'\SAP\FrontEnd\SAPgui\saplogon.exe")
window = app.Dialog
window.Wait('ready')
edit = window.Edit
edit.ClickInput()
这给了我以下错误:
error: Traceback (most recent call last) ~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pywinauto\application.py in start(self, cmd_line, timeout, retry_interval, create_new_console, wait_for_idle, work_dir) 991 work_dir, # If None - use parent's starting directory. --> 992 start_info) # STARTUPINFO structure. 993 except Exception as exc:
error: (2, 'CreateProcess', 'The system cannot find the file specified.')
During handling of the above exception, another exception occurred:
AppStartError Traceback (most recent call last) in () 1 from pywinauto.application import Application 2 ----> 3 app = Application().Start(cmd_line=u"C:\'Program Files (x86)''\SAP\FrontEnd\SAPgui\saplogon.exe") 4 window = app.Dialog 5 window.Wait('ready')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pywinauto\application.py in start(self, cmd_line, timeout, retry_interval, create_new_console, wait_for_idle, work_dir) 995 message = ('Could not create the process "%s"\n' 996 'Error returned by CreateProcess: %s') % (cmd_line, str(exc)) --> 997 raise AppStartError(message) 998 999 self.process = dw_process_id
AppStartError: Could not create the process "C:\'Program Files (x86)''\SAP\FrontEnd\SAPgui\saplogon.exe" Error returned by CreateProcess: (2, 'CreateProcess', 'The system cannot find the file specified.')
我是 运行 Win7 64 位 Python 3.6.4 :: Anaconda 自定义(64 位)和 pywingui 版本 222。我可以将命令剪切并粘贴到 cmd window 并且它启动应用程序就好了。
我已经更改了引号。我将字符串更改为原始字符串并删除了单个 \
的 \
我很生气。
此外 - 昨天 "worked",在 740 版本的 SAP GUI 中单击元素是一个真正的挑战。有什么技巧可以克服他们混淆用户界面的方法吗?
将 u"C:\'Program Files (x86)'\SAP\FrontEnd\SAPgui\saplogon.exe"
更改为 r'C:\Program Files (x86)\SAP\FrontEnd\SAPgui\saplogon.exe'
解决了问题