0

I'm really new to this. I would like to send commands to a program (Dota 2) while it is still running.

So far this is what I have:

import subprocess

dota_exe = r'C:\Program Files (x86)\Steam\SteamApps\common\dota 2 beta\game\bin\win64\dota2.exe'
dota = subprocess.Popen([dota_exe], shell=True, \
                            stdin=subprocess.PIPE, \
                            stdout=subprocess.PIPE, \
                            stderr=subprocess.STDOUT, )

Once the program is running (dota.poll() remains equal to None) I would like to be able to communicate with the program, that is, to know what it is doing. I would also like to send some commands (don't know if it's possible and I don't know which commands I could send, maybe these ones). Any suggestion or reference would be appreciated.

mat
  • 2,412
  • 5
  • 31
  • 69
  • http://stackoverflow.com/questions/33088339/input-command-doesnt-seem-to-work-when-used-with-popen-python/33089342#33089342 – Padraic Cunningham May 19 '16 at 11:10
  • If you don't have much experience with the subprocess module; take a look at the least of common [questions in the subprocess tag description](http://stackoverflow.com/tags/subprocess/info). Create a complete code example that shows your issue. Describe what you expect to happen and what happens instead step by step. Include a complete traceback if you get an error. See [mcve]. – jfs May 20 '16 at 09:05

0 Answers0