Re: Popen class?

2014-10-31 Thread Steven D'Aprano
satishmlm...@gmail.com wrote: > What is Popen class? Googling could answer that: https://duckduckgo.com/html/?q=python+popen+class If you have a specific question, please be more detailed when you ask your question, then we can give more specific answers. -- Steven -- https://mail.python.o

Re: Popen class?

2014-10-31 Thread Cameron Simpson
On 31Oct2014 05:28, satishmlm...@gmail.com wrote: What is Popen class? It's a class from the subprocess module: https://docs.python.org/3/library/subprocess.html#module-subprocess used for starting external programs, waiting for them to execute, and using their input and outputs. Cheers

Re: Popen in Python3

2013-06-19 Thread Nobody
On Wed, 19 Jun 2013 23:03:05 +, Joseph L. Casale wrote: > I am trying to invoke a binary that requires dll's in two places all of > which are included in the path env variable in windows. When running this > binary with popen it can not find either, passing env=os.environ to open > made no dif

RE: Popen and reading stdout in windows

2013-06-11 Thread Nobody
On Tue, 11 Jun 2013 01:50:07 +, Joseph L. Casale wrote: > I am using Popen to run the exe with communicate() and I have sent stdout > to PIPE without luck. Just not sure what is the proper way to iterate over > the stdout as it eventually makes its way from the buffer. The proper way is:

Re: Popen and reading stdout in windows

2013-06-11 Thread Chris Rebert
On Jun 11, 2013 12:21 AM, "Pete Forman" wrote: > > "Joseph L. Casale" writes: > > >> You leave out an awful amount of detail. I have no idea what ST is, > >> so I'll have to guess your real problem. > > > > Ugh, sorry guys its been one of those days, the post was rather > > useless... > > > > I a

Re: Popen and reading stdout in windows

2013-06-11 Thread Pete Forman
"Joseph L. Casale" writes: >> You leave out an awful amount of detail. I have no idea what ST is, >> so I'll have to guess your real problem. > > Ugh, sorry guys its been one of those days, the post was rather > useless... > > I am using Popen to run the exe with communicate() and I have sent > s

RE: Popen and reading stdout in windows

2013-06-10 Thread Joseph L. Casale
> You leave out an awful amount of detail. I have no idea what ST is, so > I'll have to guess your real problem. Ugh, sorry guys its been one of those days, the post was rather useless... I am using Popen to run the exe with communicate() and I have sent stdout to PIPE without luck. Just not su

Re: Popen and reading stdout in windows

2013-06-10 Thread Dave Angel
On 06/10/2013 02:37 PM, Joseph L. Casale wrote: I have a use where writing an interim file is not convenient and I was hoping to iterate through maybe 100k lines of output by a process as its generated or roughly anyways. Seems to be a common question on ST, and more easily solved in Linux. Anyo

Re: Popen and reading stdout in windows

2013-06-10 Thread Grant Edwards
On 2013-06-10, Joseph L. Casale wrote: > I have a use where writing an interim file is not convenient and I > was hoping to iterate through maybe 100k lines of output by a process > as its generated or roughly anyways. > > Seems to be a common question on ST, and more easily solved in Linux. > An

Re: Popen in main and subprocess

2012-01-28 Thread Thomas Rachel
Am 28.01.2012 11:19 schrieb pistacchio: the following code (in the main thread) works well, I grep some files and the search until the first 100 results are found (writing the results to a file), then exit: command = 'grep -F "%s" %s*.txt' % (search_string, DATA_PATH) p = Popen(['/bin

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread goldtech
> Read The Fine > Manual:http://docs.python.org/library/subprocess.html#subprocess.Popen: snip... > > Try instead: > cmd3 = ['ffmpeg', '-i', '/home/giga/Desktop/Guitar1.flv'] > > Cheers, > Chris > --http://blog.rebertia.com No doubt, I should RTFM...you're right! Yes, works like a charm now.

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread Rhodri James
On Tue, 19 Apr 2011 00:07:46 +0100, goldtech wrote: Trying to learn how to run a linux command and get the stdout and stderr. I'm trying the following: cmd3 = r'ffmpeg -i /home/giga/Desktop/Guitar1.flv' p = Popen(cmd3, stdout=PIPE, stderr=PIPE) Traceback (most recent call last): File ""

Re: Popen to get stdout and stderr for ffmpeg - No such file or directory ?

2011-04-18 Thread Chris Rebert
On Mon, Apr 18, 2011 at 4:07 PM, goldtech wrote: > Hi, > > Trying to learn how to run a linux command and get the stdout and > stderr. I'm trying the following: > cmd3 = r'ffmpeg -i /home/giga/Desktop/Guitar1.flv' p = Popen(cmd3, stdout=PIPE, stderr=PIPE) > > Traceback (most recent call

Re: Popen Question

2010-11-08 Thread Ian
On Nov 8, 3:35 pm, Hans Mulder wrote: > > Perhaps this example better demonstrates what is going on: > > p = subprocess.Popen(['echo one $0 three $1 five', 'two', 'four'], > > ...                      shell=True) > > one two three four five > > Maybe I'm thick, but I still don't understand.  

Re: Popen Question

2010-11-08 Thread Lawrence D'Oliveiro
In message <4cd87b24$0$81481$e4fe5...@news.xs4all.nl>, Hans Mulder wrote: > But in this case the first positional argument is in $0. That’s what confused me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Popen Question

2010-11-08 Thread Hans Mulder
Ian wrote: On Nov 8, 2:43 am, m...@distorted.org.uk (Mark Wooding) wrote: I don’t know what happens to the extra arguments, but they just seem to be ignored if -c is specified. The argument to -c is taken as a shell script; the remaining arguments are made available as positional parameters to

Re: Popen Question

2010-11-08 Thread Ian
On Nov 8, 2:43 am, m...@distorted.org.uk (Mark Wooding) wrote: > > I don’t know what happens to the extra arguments, but they just seem > > to be ignored if -c is specified. > > The argument to -c is taken as a shell script; the remaining arguments > are made available as positional parameters to t

Re: Popen Question

2010-11-08 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message , Chris Torek wrote: > > > ['/bin/sh', '-c', 'echo', '$MYVAR'] > > > > (with arguments expressed as a Python list). /bin/sh takes the > > string after '-c' as a command, and the remaining argument(s) if > > any are assigned to positional parameters (

Re: Popen Question

2010-11-08 Thread Lawrence D'Oliveiro
In message , Chris Torek wrote: > ['/bin/sh', '-c', 'echo', '$MYVAR'] > > (with arguments expressed as a Python list). /bin/sh takes the > string after '-c' as a command, and the remaining argument(s) if > any are assigned to positional parameters ($0, $1, etc). Doesn’t work. I don’t know w

Re: Popen Question

2010-11-07 Thread moogyd
Hi, Thanks everyone for the replies - it is now clearer. Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Popen Question

2010-11-05 Thread Chris Torek
In article <891a9a80-c30d-4415-ac81-bddd0b564...@g13g2000yqj.googlegroups.com> moogyd wrote: >[sde:st...@lbux03 ~]$ python >Python 2.6 (r26:66714, Feb 21 2009, 02:16:04) >[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2 >Type "help", "copyright", "credits" or "license" for more information.

Re: Popen Question

2010-11-04 Thread Alain Ketterlin
moogyd writes: import os, subprocess os.environ['MYVAR'] = "myval" p = subprocess.Popen(['echo', '$MYVAR'],shell=True) p = subprocess.Popen(['echo', '$MYVAR']) $MYVAR > p = subprocess.Popen('echo $MYVAR',shell=True) myval > p = subprocess.Popen('echo $

Re: Popen Question

2010-11-04 Thread Ravi
On Nov 4, 7:06 pm, moogyd wrote: > Hi, > I usually use csh for my simulation control scripts, but these scripts > are becoming more complex, so I plan to use python for the next > project. > To this end, I am looking at subprocess.Popen() to actually call the > simulations, and have a very basic q

Re: popen function of os and subprocess modules

2009-10-28 Thread Sean DiZazzo
On Oct 28, 7:15 am, banu wrote: > On Oct 28, 3:02 pm, Jon Clements wrote: > > > > > On 28 Oct, 13:39, banu wrote: > > > > Hi, > > > I am a novice in python. I was trying to write a simple script on > > > Linux (python 3.0) that does the following > > > > #cd directory > > > #ls -l > > > > I use

Re: popen function of os and subprocess modules

2009-10-28 Thread Albert Hopkins
On Wed, 2009-10-28 at 07:15 -0700, banu wrote: > > Thanks for the reply Jon > Basically I need to move into a folder and then need to execute some > shell commands(make etc.) in that folder. I just gave 'ls' for the > sake of an example. The real problem I am facing is, how to stay in > the folder

Re: popen function of os and subprocess modules

2009-10-28 Thread banu
On Oct 28, 3:18 pm, Benjamin Kaplan wrote: > On Wed, Oct 28, 2009 at 9:39 AM, banu wrote: > > Hi, > > I am a novice in python. I was trying to write a simple script on > > Linux (python 3.0) that does the following > > > #cd directory > > #ls -l > > > I use the following code, but it doesn't work

Re: popen function of os and subprocess modules

2009-10-28 Thread banu
On Oct 28, 3:02 pm, Jon Clements wrote: > On 28 Oct, 13:39, banu wrote: > > > > > Hi, > > I am a novice in python. I was trying to write a simple script on > > Linux (python 3.0) that does the following > > > #cd directory > > #ls -l > > > I use the following code, but it doesn't work: > > > impo

Re: popen function of os and subprocess modules

2009-10-28 Thread Benjamin Kaplan
On Wed, Oct 28, 2009 at 9:39 AM, banu wrote: > Hi, > I am a novice in python. I was trying to write a simple script on > Linux (python 3.0) that does the following > > #cd directory > #ls -l > > I use the following code, but it doesn't work: > > import os > directory = '/etc' > pr = os.popen('cd %

Re: popen function of os and subprocess modules

2009-10-28 Thread Jon Clements
On 28 Oct, 13:39, banu wrote: > Hi, > I am a novice in python. I was trying to write a simple script on > Linux (python 3.0) that does the following > > #cd directory > #ls -l > > I use the following code, but it doesn't work: > > import os > directory = '/etc' > pr = os.popen('cd %s' % directory,

Re: Popen question (redundant processes)

2009-08-30 Thread Gabriel Genellina
En Sun, 30 Aug 2009 17:25:40 -0300, Chris Rebert escribió: On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote: Hello World! This is my first post on the list and I'm hoping it is the right forum and not OT, I've searched a bit on this, but, none-the-wiser! My question is on the Popen meth

Re: Popen question (redundant processes)

2009-08-30 Thread Chris Rebert
On Sun, Aug 30, 2009 at 12:33 PM, Sebastian wrote: > Hello World! > This is my first post on the list and I'm hoping it is the right forum and > not OT, I've searched > a bit on this, but, none-the-wiser! > > My question is on the Popen method, here is my snippet: > >> p1 = Popen(["cat", "georgi_dd

Re: Popen

2009-07-24 Thread Chris Rebert
> --- On Fri, 7/24/09, Diez B. Roggisch wrote: > >> From: Diez B. Roggisch >> Subject: Re: Popen >> To: python-list@python.org >> Date: Friday, July 24, 2009, 12:35 PM >> Tim schrieb: >> > Thanks! Yes I mean subprocess.Popen. >> > >> &g

Re: Popen

2009-07-24 Thread Tim
Thanks! If that is the case, i.e. the parent doesn't wait, is the code in my last post wrong? "result" could be nothing. --- On Fri, 7/24/09, Diez B. Roggisch wrote: > From: Diez B. Roggisch > Subject: Re: Popen > To: python-list@python.org > Date: Friday, Ju

Re: Popen

2009-07-24 Thread Francesco Bochicchio
On Jul 24, 6:24 pm, Tim wrote: > Thanks! > Yes I mean subprocess.Popen. > > I was wondering the meaning of "asynchronously" > Here is some code I am reading recently: > " > result = Popen(cmdline,shell=True,stdout=PIPE).stdout > for line in result.readlines(): >     if find(line,"Cross") != -1: >

Re: Popen

2009-07-24 Thread Diez B. Roggisch
Tim schrieb: Thanks! Yes I mean subprocess.Popen. I was wondering the meaning of "asynchronously" Here is some code I am reading recently: " result = Popen(cmdline,shell=True,stdout=PIPE).stdout for line in result.readlines(): if find(line,"Cross") != -1: return float(split(line)[

Re: Popen

2009-07-24 Thread Tim
f "asynchronous"? Thanks and regards! --- On Fri, 7/24/09, Kushal Kumaran wrote: > From: Kushal Kumaran > Subject: Re: Popen > To: "Tim" > Cc: python-list@python.org > Date: Friday, July 24, 2009, 10:58 AM > On Fri, Jul 24, 2009 at 7:33 PM, > Tim > wrote:

Re: Popen

2009-07-24 Thread Piet van Oostrum
> Tim (T) wrote: >T> Hi, >T> I wonder if I use Popen, the parent process will wait for the child process >to finish or continue without waiting? >T> Thanks and regards! Only if you use Popen.wait(), Popen.communicate() or something similar like os.waitpid(), subprocess.call() -- P

Re: Popen

2009-07-24 Thread Kushal Kumaran
On Fri, Jul 24, 2009 at 7:33 PM, Tim wrote: > > Hi, > I wonder if I use Popen, the parent process will wait for the child process > to finish or continue without waiting? > Thanks and regards! > Assuming you mean subprocess.Popen, the child is executed asynchronously. You can use the wait() meth

Re: Popen File I/O

2009-05-27 Thread D'Arcy J.M. Cain
On Wed, 27 May 2009 19:39:21 -0500 Eric Pruitt wrote: > I am creating a file-like interface for Popen. Do I need to return True or > False for "isatty()"? I am thinking True but I am not familiar with the > semantics of what defines a tty. >>> import os >>> x = os.popen("ls") >>> type(x)

Re: popen - reading strings - constructing a list from the strings

2009-05-21 Thread norseman
MRAB wrote: Aytekin Vargun wrote: First of all, Thanks for the suggestions, MRAB and norseman. "split()" was what I was looking for. Now I have a follow up question. In my application I create radio buttons in a frame. These radio buttons are constructed whenever a button is clicked. Therefor

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread MRAB
Aytekin Vargun wrote: First of all, Thanks for the suggestions, MRAB and norseman. "split()" was what I was looking for. Now I have a follow up question. In my application I create radio buttons in a frame. These radio buttons are constructed whenever a button is clicked. Therefore the list of

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread Aytekin Vargun
First of all, Thanks for the suggestions, MRAB and norseman. "split()" was what I was looking for. Now I have a follow up question. In my application I create radio buttons in a frame. These radio buttons are constructed whenever a button is clicked. Therefore the list of items are dynamically chan

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread norseman
MRAB wrote: Aytekin Vargun wrote: Hello everybody, I have a question about the way I use os.popen. I am open to other alternative suggestions like using subprocess or communicate. I have an executable (say read_cell_types.exe) that produces string outputs. For

Re: popen - reading strings - constructing a list from the strings

2009-05-20 Thread MRAB
Aytekin Vargun wrote: Hello everybody, I have a question about the way I use os.popen. I am open to other alternative suggestions like using subprocess or communicate. I have an executable (say read_cell_types.exe) that produces string outputs. For example, aft

Re: Popen: NameError: name 'PIPE' is not defined

2008-05-24 Thread Mathieu Prevot
2008/5/24 Diez B. Roggisch <[EMAIL PROTECTED]>: > Mathieu Prevot schrieb: >> >> Hi >> >> I import subprocess and use Popen, but PIPE is not defined. I used >> 2.5.1, 2.5.2, Python 2.6a3+ (trunk:63576, May 24 2008, 12:13:40), it's >> always the same. What am I missing ? > > Without showing code, it'

Re: Popen: NameError: name 'PIPE' is not defined

2008-05-24 Thread Jack Yu
On Sat, 24 May 2008 14:09:07 +0200,Mathieu Prevot wrote: > Hi > > I import subprocess and use Popen, but PIPE is not defined. I used > 2.5.1, 2.5.2, Python 2.6a3+ (trunk:63576, May 24 2008, 12:13:40), it's > always the same. What am I missing ? > > Thanks > Mathieu Try subprocess.PIPE. -- http:

Re: Popen: NameError: name 'PIPE' is not defined

2008-05-24 Thread Diez B. Roggisch
Mathieu Prevot schrieb: Hi I import subprocess and use Popen, but PIPE is not defined. I used 2.5.1, 2.5.2, Python 2.6a3+ (trunk:63576, May 24 2008, 12:13:40), it's always the same. What am I missing ? Without showing code, it's hard to know. A guess is: if you use import subprocess then us

Re: Popen pipe hang

2008-05-12 Thread schickb
On May 12, 7:35 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > >from subprocess import Popen, PIPE > >from array import array > > >arr = array('B') > >arr.fromstring("hello\n") > > >src = Popen( ["cat"], stdin=PIPE, stdout=PIPE) > >dst = Popen( ["cat"], stdin=src.stdout) > >arr.tofile(src.std

Re: Popen pipe hang

2008-05-12 Thread Jean-Paul Calderone
On Mon, 12 May 2008 17:35:44 -0700 (PDT), schickb <[EMAIL PROTECTED]> wrote: I'm trying to pipe data that starts life in an array('B') object through several processes. The code below is a simplified example. The data makes it through, but the wait() always hangs. Is there a better way to indicat

Re: popen pipe limit

2008-04-09 Thread skunkwerk
On Apr 7, 6:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 07 Apr 2008 20:52:54 -0300,skunkwerk<[EMAIL PROTECTED]>   > escribió: > > > I'm getting errors when reading from/writing to pipes that are fairly > > large in size.  To bypass this, I wanted to redirect output to a file > >

Re: popen pipe limit

2008-04-07 Thread Gabriel Genellina
En Mon, 07 Apr 2008 20:52:54 -0300, skunkwerk <[EMAIL PROTECTED]> escribió: > I'm getting errors when reading from/writing to pipes that are fairly > large in size. To bypass this, I wanted to redirect output to a file > in the subprocess.Popen function, but couldn't get it to work (even > afte

Re: popen question

2008-01-08 Thread Karthik Gurusamy
On Jan 8, 1:20 am, Robert Latest <[EMAIL PROTECTED]> wrote: > Hello, > > look at this function: > > -- > def test(): > child = os.popen('./slow') > for line in child: > print line > - > > The program "slow" just writes the numbers 0 through 9 on stdout, one l

Re: popen question

2008-01-08 Thread Hrvoje Niksic
Robert Latest <[EMAIL PROTECTED]> writes: >> If you see lines one by one, you are in luck, and you can fix things >> on the Python level simply by avoiding buffering in popen. If not, >> you will need to resort to more advanced hackery (e.g. fixing stdio >> using LD_PRELOAD). > > Do I really? Aft

(SOLVED) Re: popen question

2008-01-08 Thread Robert Latest
pexpect is the solution. Seems to wrap quite a bit of dirty pseudo-tty hacking. robert -- http://mail.python.org/mailman/listinfo/python-list

Re: popen question

2008-01-08 Thread Robert Latest
Hrvoje Niksic wrote: > stdio uses different buffering strategies depending on the output > type. When the output is a TTY, line buffering is used; when the > output goes to a pipe or file, it is fully buffered. Makes sense. > If you see lines one by one, you are in luck, and you can fix things

Re: popen question

2008-01-08 Thread Hrvoje Niksic
Robert Latest <[EMAIL PROTECTED]> writes: > If 'slow' or some other program does buffered output, how come I can > see its output line-by-line in the shell? stdio uses different buffering strategies depending on the output type. When the output is a TTY, line buffering is used; when the output g

Re: popen question

2008-01-08 Thread Robert Latest
Marc 'BlackJack' Rintsch wrote: > Both processes have to make their communication ends unbuffered or line > buffered. Yeah, I figured something like that. > And do whatever is needed to output the numbers from ``slow`` > unbuffered or line buffered. Hm, "slow" of course is just a little test pr

Re: popen question

2008-01-08 Thread Marc 'BlackJack' Rintsch
On Tue, 08 Jan 2008 09:20:16 +, Robert Latest wrote: > The program "slow" just writes the numbers 0 through 9 on stdout, one line a > second, and then quits. > > I would have expected the python program to spit out a numbers one by one, > instead I see nothing for 10 seconds and then the wh

Re: POpen - Wait For Process To Complete

2007-07-03 Thread Yongjian Xu
That's by using the P3/P4 classes not the function. the function does not provide wait() call, it simply does it for you by default. Jim On 7/3/07, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> wrote: Hello guys, Quite a simple one I'm hoping. I've got a process that I run using popen whi

Re: popen and a long running process in a wx.python application

2007-06-27 Thread Doru Moisa
Mike, Ratko, Thanks a lot guys, for the quick and prompt answers. Doru -- http://mail.python.org/mailman/listinfo/python-list

Re: popen and a long running process in a wx.python application

2007-06-26 Thread Ratko
On Jun 26, 10:16 am, Doru Moisa <[EMAIL PROTECTED]> wrote: > Hello, > > How can I capture the output of a long runnning process which I open > with popen() ? > I tried reading line by line, char by char, but the result always > comes when the process finishes. > (I am trying to make a wx.python pro

Re: popen and a long running process in a wx.python application

2007-06-26 Thread kyosohma
On Jun 26, 10:16 am, Doru Moisa <[EMAIL PROTECTED]> wrote: > Hello, > > How can I capture the output of a long runnning process which I open > with popen() ? > I tried reading line by line, char by char, but the result always > comes when the process finishes. > (I am trying to make a wx.python pro

Re: popen e pclose on python 2.3 question

2007-06-12 Thread Flyzone
> i need to kill the child if the program take more than 300 ms, but i > need also to wait this 300 ms to have the reply. I reply by myself: from popen2 import Popen3 cmd = Popen3('command','r') waiting=0 while (cmd.poll()==-1): time.sleep(0.1) waiting+=1 if (waiting>3): os.k

Re: Popen and wget, problems

2007-05-13 Thread js
Hi Jesse. > cmd_set = ['wget', '-nv', '-O dir/cpan.txt', 'http://search.span.org'] [snip] >proc = Popen(cmd_set, stdout=PIPE, stderr=PIPE) wget will treat this as $ wget -nv '-O dir/cpan.txt' "http://search.cpan.org"; And will emit the following error because there's no pathname ' dir/cpan.txt'.

Re: Popen and wget, problems

2007-05-13 Thread Jesse
Thx Rob! Your solution works perfect! "Rob Wolfe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Jesse" <[EMAIL PROTECTED]> writes: > >> Hi all, I have a problem using wget and Popen. I hope someone can help. >> >> >> -- Problem -- >> I want to use the command: >> wget -nv -O "d

Re: Popen and wget, problems

2007-05-12 Thread Rob Wolfe
"Jesse" <[EMAIL PROTECTED]> writes: > Hi all, I have a problem using wget and Popen. I hope someone can help. > > > -- Problem -- > I want to use the command: > wget -nv -O "dir/cpan.txt" "http://search.cpan.org"; > and capture all it's stdout+stderr. > (Note that option -O requires 'dir' to be ex

Re: popen, Pipes with programs that expect user input

2007-01-08 Thread Gabriel Genellina
At Monday 8/1/2007 13:06, Alex wrote: So far everything works fine, but I encounter a problem with commands which require some sort of user input; i.e. they don't return immediately. Could someone point out the cause of this? It seems to me that the interpreter is stuck at this line data=fou

Re: popen on windows

2007-01-02 Thread hubritic
Thanks for your reply. I figured it out. I was not closing the file that path pointed to before executing the command. D'oh! So sometimes it read the file that was created on the previous test run ... Anyway, for the benefit of anyone who might be googling for a similar question, what seems to wor

Re: popen on windows

2006-12-29 Thread Daniel Klein
On 27 Dec 2006 09:16:53 -0800, "hubritic" <[EMAIL PROTECTED]> wrote: >I am trying to set off commands on Windows 2003 from python. >Specifically, I am trying to use diskpart with a script file (pointed >to with path). > >cmd = ["diskpart", "/s", path] >p = Popen(cmd, shell

Re: popen(1-4) as a seperate process

2006-11-17 Thread Astan Chee
Dennis Lee Bieber wrote: > On Fri, 17 Nov 2006 18:53:41 +1100, Astan Chee <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > >> What would be a good method to do this? I've tried your >> os.system("command&") and the spawned process is still the child of the >> current

Re: popen(1-4) as a seperate process

2006-11-16 Thread Astan Chee
Fredrik Lundh wrote: > Astan Chee wrote: > > >> Yes, that is true. But everytime I run a os.popen() it executes as a >> child process of the current running one. How do I launch as a seperate >> process? >> > > what's your definition of "separate process", and how is that different > fro

Re: popen(1-4) as a seperate process

2006-11-16 Thread Fredrik Lundh
Astan Chee wrote: > Yes, that is true. But everytime I run a os.popen() it executes as a > child process of the current running one. How do I launch as a seperate > process? what's your definition of "separate process", and how is that different from a child process? (all processes created by

Re: popen(1-4) as a seperate process

2006-11-16 Thread Astan Chee
Fredrik Lundh wrote: Astan Chee wrote: Im trying to popen (or more specifically os.popen4() ) from wxPython. I've read the documentation on popen and it says I can do a popen as a seperate process or popen not as a child process where does it say that? afaik, the whole point of the

Re: popen(1-4) as a seperate process

2006-11-16 Thread Fredrik Lundh
Astan Chee wrote: > Im trying to popen (or more specifically os.popen4() ) from wxPython. > I've read the documentation on popen and it says I can do a popen as a > seperate process or popen not as a child process where does it say that? afaik, the whole point of the popen API is to run an ex

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > child.expect(['Password:','Password: ',pexpect.EOF,pexpect.TIMEOUT]) > if i == 0: child.sendline(passwd) > elif i == 1:print 1 > elif i == 2:print 2 > elif i == 3:prin

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
finally following code works, import pexpect, sys cmd = '/usr/bin/rsync config [EMAIL PROTECTED]:/tmp/.' #cmd = 'ssh [EMAIL PROTECTED]' child = pexpect.spawn(cmd) child.logfile = sys.stdout passwd = 'qwe123' i = 0 try: while i == 0: i = child.expect(['Password:','Password:

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
i put while True: before top of line, i=child.expect() . it worked, the file has gone but also it goes into loop with many EOF result, i tried the os.waitpid() function with child.pid but didnt help me. still couldn`t get the problem. thanks for help On Thursday 15 June 2006 12:04, Ganesan Raj

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > thanks for reply, i add the line you suggested, thats what i get > [EMAIL PROTECTED]:~/tmp/multi_server$ python deneme.py > Password: qwe123 > finished Ah, got it. You didn't wait for the rsync process to complete. Put the body of the "try:" in a

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
thanks for reply, i add the line you suggested, thats what i get [EMAIL PROTECTED]:~/tmp/multi_server$ python deneme.py Password: qwe123 finished Exception pexpect.ExceptionPexpect: in > ignored does rsync may cause a problem while trying to fork-exec ssh ? > Add "child.logfile = sys.stdout" he

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> Sinan Nalkaya <[EMAIL PROTECTED]> writes: > hi, > i have found expect method for this purpose. i`m trying to use pexpect but > following code gives me an something strange as a result. When working with pexpect, logging the entire conversation is extremely useful fro debugging > import pex

Re: popen and password entry

2006-06-14 Thread Sinan Nalkaya
hi,i have found expect method for this purpose. i`m trying to use pexpect but following code gives me an something strange as a result.# The CODEimport pexpectcmd = '/usr/bin/rsync config [EMAIL PROTECTED]:/tmp/.' #cmd = 'ssh [EMAIL PROTECTED]'child = pexpect.spawn(cmd)passwd = 'qwe123'try:   

Re: popen and password entry

2006-06-14 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > i want to use rsync for remote file transfer via popen, but couldnt pass > the Password yet. For interactive input try the pexpect module instead of popen (see http://pexpect.sf.net). Ganesan -- Ganesan Rajagopal -- http://mail.python.org/ma

Re: popen and exit code on Windows

2006-03-07 Thread iker . arizmendi
Thanks for the reply Giovanni. Is this behaviour of the close method on Windows documented anywhere? Regards, Iker -- http://mail.python.org/mailman/listinfo/python-list

Re: popen and exit code on Windows

2006-03-07 Thread Giovanni Bajo
[EMAIL PROTECTED] wrote: > On UNIX one can use popen* to get a pipe for reading, a pipe for > writing, and the exit code of the child process via a call to close() > on the last pipe. Is there any way, in principle, to simulate such > behaviour on Windows? Some googling reveals that direct use of

Re: popen in thread on QNX

2005-09-13 Thread Jacek Popławski
Laszlo, I can't reply your mails, your address doesn't work, please try jacekpoplawski-at-gmail.com -- http://mail.python.org/mailman/listinfo/python-list

Re: popen in thread on QNX

2005-09-08 Thread [EMAIL PROTECTED]
spawn() works on QNX, fork() does not. -- http://mail.python.org/mailman/listinfo/python-list

Re: popen in thread on QNX

2005-09-08 Thread Jacek Popławski
Laszlo Zsolt Nagy wrote: > - one of your worker threads wants to run a command > - it creates the argument list and puts it into a message queue > - woker thread starts to sleep > - main thread processes the message queue -> it will run popen, put back > the file descriptors into the message and w

Re: popen in thread on QNX

2005-09-08 Thread Laszlo Zsolt Nagy
>>os.popen already creates a new process. So what if you try to call >>os.popen from your main thread, then pass the file descriptors to your >>thread? >>It is just an idea... >> >> > >But I need to run command from thread, that's the main reason to create >new thread :) > > Ok, but can't

Re: popen in thread on QNX

2005-09-08 Thread Jacek Popławski
Laszlo Zsolt Nagy wrote: > os.popen already creates a new process. So what if you try to call > os.popen from your main thread, then pass the file descriptors to your > thread? > It is just an idea... But I need to run command from thread, that's the main reason to create new thread :) -- http

Re: popen in thread on QNX

2005-09-08 Thread Laszlo Zsolt Nagy
Jacek Popławski wrote: >I am still in the process of creating my script which will run command >received from socket. >My scripts works perfectly on Linux, but doesn't work on QNX! > >File "/usr/lib/python2.4/popen2.py", line 108, in __init__ > self.pid = os.fork() >OSError: [Errno 89] Func

Re: popen in thread on QNX

2005-09-08 Thread Jacek Popławski
It works when I use os.system() instead os.popen3(), but with os.system() I have no access to stdout and stderr :-( -- http://mail.python.org/mailman/listinfo/python-list