So it seems there is no good way to handle interactive processes on
windows using python. By interactive I mean processes/commands that
require user interaction, such as telnet or del (to delete a file or
directory sometimes you need to confirm with a yes or no), date, etc.
os.system gives the
jas wrote:
So it seems there is no good way to handle interactive processes on
windows using python. By interactive I mean processes/commands that
require user interaction, such as telnet or del (to delete a file or
directory sometimes you need to confirm with a yes or no), date, etc.
Steve Holden wrote:
Look at how you might do it in other languages. Then you'll realise this
isn't (just) a Python problem.
Yea your right. However, for example, in Java, one can use the Process
class, and then read from the stream until its the end (i.e. -1 is
returned). However, with Python
Jas,
I use a python called twisted to run processes as you describe.
Twisted is an event-driven framework that brings a change in the
way that you look at things.
take a look at:
http://twistedmatrix.com/projects/core/documentation/howto/process.html
Good luck, hope this is useful,
Mike
jas
Quoth jas [EMAIL PROTECTED]:
| Steve Holden wrote:
| Look at how you might do it in other languages. Then you'll realise this
| isn't (just) a Python problem.
|
| Yea your right. However, for example, in Java, one can use the Process
| class, and then read from the stream until its the end (i.e.
I have setup multiple threads and a queue...which is working pretty
good. But I have one other issue...I have a new thread (since it is
different issue) here:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/ec81d8982d1a0130
if you get chance, would you mind checking that out.
I have setup multiple threads and a queue...which is working pretty
good. But I have one other issue...I have a new thread (since it is
different issue) here:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/ec81d8982d1a0130
if you get chance, would you mind checking that out.
Dennis Lee Bieber [EMAIL PROTECTED] writes:
Followed by the Amiga... The Amiga IPC used message ports (linked
lists owned by the creating process to which, if public [named], other
processes could send message packets). The Amiga port of REXX made use
of message ports as its native
On Tue, 25 Oct 2005 17:32:28 GMT, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
On 25 Oct 2005 05:22:20 -0700, jas [EMAIL PROTECTED] declaimed the
following in comp.lang.python:
So it seems there is no good way to handle interactive processes on
windows using python. By interactive I mean
Hi,
I would like to start a new process and be able to read/write from/to
it. I have tried things like...
import subprocess as sp
p = sp.Popen(cmd.exe, stdout=sp.PIPE)
p.stdin.write(hostname\n)
however, it doesn't seem to work. I think the cmd.exe is catching it.
I also tried
f =
Thanks, that is certainly a start. As you mentioned, the cd could is
an issue.
Perhaps checking to see if the line ends with is sufficient?
Dennis Lee Bieber wrote:
On 24 Oct 2005 07:20:42 -0700, jas [EMAIL PROTECTED] declaimed the
following in comp.lang.python:
Hi,
I would like to
actually, i can't check for only because if you a dir, a line can
end with a but is not the end of the output
jas wrote:
Thanks, that is certainly a start. As you mentioned, the cd could is
an issue.
Perhaps checking to see if the line ends with is sufficient?
Dennis Lee Bieber wrote:
What about having a thread which reads from subprocess.Popen()'s
stdout...instead of read/write, read/write. just always read, and
write when needed?
any comments on that idea?
jas wrote:
actually, i can't check for only because if you a dir, a line can
end with a but is not the end of the
13 matches
Mail list logo