attach to process by pid?

John Nagle nagle at animats.com
Sat Mar 12 00:34:40 EST 2011


On 3/9/2011 5:38 PM, Miki Tebeka wrote:
>> Is there any way to attach to an already running process by pid? I
>> want to send commands from python to an application that is already
>> running. I don't want to give the command name to
>> subprocess.Popen.
> We probably need more information. What do you mean by "send
> commands"? (What was your work flow if you could give the command
> name to Popen?)

There are ways under Windows to attach to a running process and do 
things to it.  Look up "CreateRemoteThread".  There's a way to
do this under Linux, too.  See 
"http://www.codeproject.com/KB/DLL/code_injection.aspx".

It is very unlikely that a Python programmer would use either of
these.  The original poster needs to express more clearly what
they really want to do.  I suspect they want to create a server
that client programs can talk to.  There are good ways to do that,
both on the same machine and across a network.

				John Nagle




More information about the Python-list mailing list