Ernesto wrote: > I'm opening a telnet session with the subprocess call below. I then > wait ten seconds and attempt to terminate the telnet window I created. > Unfortuantely, the telnet window remains after the 'TerminateProcess" > call below. This software works great for opening an executable > directly (i.e. Handle = subprocess.Popen("myProgram.exe), but here I'm > using the Windows 'start' command inside, which I think has an effect. > > > Is there another way I can force termination of the telnet session I > create ? > > # CODE STARTS HERE > > TSS_Log_Path = "C:\\Log_Outputs\\TSS_Log_Test.txt" > TSS_Handle = subprocess.Popen("start telnet.exe -f " + TSS_Log_Path + " > localhost 6000",shell=True) > time.sleep(10) > ctypes.windll.kernel32.TerminateProcess(int(TSS_Handle._handle), -1) # > Terminate the TSS_Log > > # END CODE
Actually, the original answer I was looking for to for a "hard close" of telnet in Windows is: TSS_Handle = subprocess.Popen("TASKKILL /F /IM telnet.exe", shell=True) It is almost definitely true though that it is safer to use telnetlib. I just don't have the time to adjust my entire huge application at the moment. Thanks all. -- http://mail.python.org/mailman/listinfo/python-list