Making Popen items terminate when program ends.

Peter Hansen peter at engcorp.com
Fri Feb 3 21:43:42 EST 2006


Ernesto wrote:
> I used Popen to launch a seperate telnet window, like this:
> 
> subprocess.Popen("start telnet.exe -f C:\Folder\File.txt localhost
> 6000",shell=True)

I can't answer the direct question, but this is the second post of yours 
I've seen with clear danger signals: you apparently don't know yet about 
"raw" strings and escaping of special characters.  You are getting away 
with it right now because you happen to have used uppercase F characters 
in the above string, but if they had been lowercase you'd have real 
troubles.

Please see this page: http://docs.python.org/ref/strings.html and read 
about escape sequences in strings, and about raw strings.  You should 
either prefix your string with an "r" (just before the opening quotation 
mark) or escape the backslashes (as in use "C:\\Folder..." instead of 
just "C:\Folder").

-Peter




More information about the Python-list mailing list