Reputation: 55
I have a Python (.py) file and need to execute it from AutoIt. How can I do this?
Upvotes: 1
Views: 7563
Reputation: 36506
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.
Upvotes: 5
Reputation: 55
RunWait("C:\Python27\Python.exe filename.py")
this code working fine run from autoit
Upvotes: 0