Making Popen items terminate when program ends.

E

Ernesto

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 is preferable to have this telnet window with the python program. Is
there something I can do to that line of code to make that happen, or
perhaps another line I can add to the end to force this ? Thanks
 
P

Peter Hansen

Ernesto said:
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
 
R

Roy Smith

Peter Hansen said:
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").

Of the two alternatives, raw stings are much preferable to escaping
backslashes (IMHO).
 
P

Peter Hansen

Roy said:
Of the two alternatives, raw stings are much preferable to escaping
backslashes (IMHO).

No, it's definitely preferable to avoid being slashed than it is to get
stung. <wink>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top