user1808286
user1808286

Reputation: 55

Execute Python script from AutoIt

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

Upvotes: 1

Views: 7563

Answers (2)

Calvin Cheng
Calvin Cheng

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

user1808286
user1808286

Reputation: 55

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

this code working fine run from autoit

Upvotes: 0

Related Questions