Re: Read/Write from/to a process

2005-10-25 Thread jas
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

Re: Read/Write from/to a process

2005-10-25 Thread Steve Holden
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.

Re: Read/Write from/to a process

2005-10-25 Thread jas
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

Re: Read/Write from/to a process

2005-10-25 Thread Michael Schneider
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

Re: Read/Write from/to a process

2005-10-25 Thread Donn Cave
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.

Re: Read/Write from/to a process

2005-10-25 Thread jas
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.

Re: Read/Write from/to a process

2005-10-25 Thread jas
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.

Re: Read/Write from/to a process

2005-10-25 Thread Mike Meyer
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

Re: Read/Write from/to a process

2005-10-25 Thread Bengt Richter
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

Read/Write from/to a process

2005-10-24 Thread jas
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 =

Re: Read/Write from/to a process

2005-10-24 Thread jas
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

Re: Read/Write from/to a process

2005-10-24 Thread jas
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:

Re: Read/Write from/to a process

2005-10-24 Thread jas
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