0

so I am writing a python script that should run constantly in the background and once in a while pings a site to see if my router has failed. Anyway, since it's a python script, I am running it as a pyw file, but no matter what way I try calling the ping command, a window always pops out (even if only for a milisecond). What I've tried so far (and haven't worked):

subprocess.call("ping google.com", stdout = IGNORE, stderr = IGNORE)

subprocess.check_output("ping google.com", stdout = IGNORE, stderr = IGNORE)

os.system("ping google.com")

Thanks!

GMan
  • 81
  • 7
  • 1
    Try `subprocess.call('cmd /c "start /min ping google.com"')` – martineau Jan 26 '13 at 18:56
  • Hey, the window still pops out. Thanks anyway! – GMan Jan 26 '13 at 19:41
  • 1
    Did you put it in a .pyw script? -- because that doesn't happen on my system. I see an entry in the taskbar for a second, then it goes away. – martineau Jan 26 '13 at 20:45
  • Yeah, I've tested that on a different machine, and it is working fine. I have no idea why a window keeps popping on this one (same OS and same/newer version of python). – GMan Jan 27 '13 at 21:01

1 Answers1

0

you can save ping outputs into file, then print the file content

os.system("ping google.com>google.log")
Z3r0n3
  • 37
  • 4