Execute Python script from AutoIt

你说的曾经没有我的故事 提交于 2019-12-13 04:47:42

问题


I have a Python (.py) file and need to execute it from AutoIt. How can I do this?


回答1:


Python scripts can be executed from command line. For a script called myscript.py, you can run it (assuming Python is installed) by typing:

python myscript.py

If you want to run myscript.py without having to prefix it by python, then set the path to the Python binary (e.g. C:\Python27\Python.exe) as Windows environment variable. This enables AutoIt to execute the Python script as if it were an external program. Reference: ShellExecute().

ShellExecute("myscript.py")

Point to where myscript.py resides of course. Use:

RunWait("C:\Python27\Python.exe myscript.py")

to avoid setting environment variables.




回答2:


RunWait("C:\Python27\Python.exe filename.py")

this code working fine run from autoit



来源:https://stackoverflow.com/questions/13524339/execute-python-script-from-autoit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!