Re: threading+popen2 hang

2010-02-08 Thread Aahz
In article <2542cf60-a193-4087-a1fe-1d60ee13c...@v25g2000yqk.googlegroups.com>, lofic wrote: >On 7 f=E9v, 17:00, a...@pythoncraft.com (Aahz) wrote: >> In article <188bfb67-3334-4325-adfc-3fa4d28f0...@d27g2000yqn.googlegroups= >.com>, >> lofic =A0 wrote: >>> >>>Works fine on RHEL5/python 2.4.3 >>>

Re: threading+popen2 hang

2010-02-08 Thread lofic
On 7 fév, 17:00, a...@pythoncraft.com (Aahz) wrote: > In article > <188bfb67-3334-4325-adfc-3fa4d28f0...@d27g2000yqn.googlegroups.com>, > > lofic   wrote: > > >Works fine on RHEL5/python 2.4.3 > >Hangs on RHEL4/python 2.3.4 > > Then use Python 2.4 -- surely you don't expect anyone to provide bugfi

Re: threading+popen2 hang

2010-02-07 Thread Aahz
In article <188bfb67-3334-4325-adfc-3fa4d28f0...@d27g2000yqn.googlegroups.com>, lofic wrote: > >Works fine on RHEL5/python 2.4.3 >Hangs on RHEL4/python 2.3.4 Then use Python 2.4 -- surely you don't expect anyone to provide bugfixes for a release that's several years old? -- Aahz (a...@pythoncra

threading+popen2 hang

2010-02-02 Thread lofic
Hello, I've seen many messages and bug reports on popen2 about pipes, buffer size problems, sub-processes not properly closed, race conditions, popen2 not being thread safe... But I still can't figure what applies to my case. This piece of code: #!/usr/bin/python import threading imp

Re: mode parameter in popen2-4

2007-08-20 Thread Gabriel Genellina
On 20 ago, 17:26, Tobiah <[EMAIL PROTECTED]> wrote: > In the popen docs, a file like object is returned, > and may be read to or written to depending on the > 'mode' parameter ('r', or 'w'). > > Why is the mode parameter needed for popen2 an

mode parameter in popen2-4

2007-08-20 Thread Tobiah
In the popen docs, a file like object is returned, and may be read to or written to depending on the 'mode' parameter ('r', or 'w'). Why is the mode parameter needed for popen2 and greater, when both a stdin and stdout object is returned? One wouldn't wan

Re: popen2 results

2007-04-25 Thread Steven Howe
27;d the output from these commands to determine the outcome. I'm now using popen2 to run the command which works a charm, but I'm struggling to parse the results of the function, has anyone had any experience with this? I've found a few suggested solutions dotted around, such as

popen2 results

2007-04-25 Thread Robert Rawlins - Think Blue
o determine the outcome. I'm now using popen2 to run the command which works a charm, but I'm struggling to parse the results of the function, has anyone had any experience with this? I've found a few suggested solutions dotted around, such as this one. import os

Re: postgres backup script and popen2

2007-02-08 Thread flupke
flupke schreef: Thanks for all the info. I'm sure i will get it right this time :) Benedict -- http://mail.python.org/mailman/listinfo/python-list

Re: postgres backup script and popen2

2007-02-08 Thread Nikita the Spider
t; Problem is that it prompts for a password. It thought i > > > could solve this by using popen2. > > > > Use pexpect:http://pexpect.sourceforge.net/ > > pexpect could work. But a better way would be to supply the password > on the command line. I don't know how pos

Re: postgres backup script and popen2

2007-02-08 Thread Jean-Paul Calderone
in Mettler <[EMAIL PROTECTED]> wrote: >> >> flupke schrieb: >> >> > i made a backup script to backup my postgres database. >> >> > Problem is that it prompts for a password. It thought i >> >> > could solve this by using popen2. >> >> &g

Re: postgres backup script and popen2

2007-02-08 Thread Gabriel Genellina
e a backup script to backup my postgres database. > >> > Problem is that it prompts for a password. It thought i > >> > could solve this by using popen2. > > >> Use pexpect:http://pexpect.sourceforge.net/ > > >pexpect could work. But a better way would be to su

Re: postgres backup script and popen2

2007-02-08 Thread Jean-Paul Calderone
ts for a password. It thought i >> > could solve this by using popen2. >> >> Use pexpect:http://pexpect.sourceforge.net/ > >pexpect could work. But a better way would be to supply the password >on the command line. So that it shows up in `ps' output to anyone on the system? :) Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: postgres backup script and popen2

2007-02-08 Thread Gabriel Genellina
On 8 feb, 10:27, Maël Benjamin Mettler <[EMAIL PROTECTED]> wrote: > flupke schrieb: > > i made a backup script to backup my postgres database. > > Problem is that it prompts for a password. It thought i > > could solve this by using popen2. > > Use pexpect:http://

Re: postgres backup script and popen2

2007-02-08 Thread Maël Benjamin Mettler
Use pexpect: http://pexpect.sourceforge.net/ flupke schrieb: > Hi, > > i made a backup script to backup my postgres database. > Problem is that it prompts for a password. It thought i > could solve this by using popen2. > I tested popen2 with dir (i'm on windows 2000,

postgres backup script and popen2

2007-02-08 Thread flupke
Hi, i made a backup script to backup my postgres database. Problem is that it prompts for a password. It thought i could solve this by using popen2. I tested popen2 with dir (i'm on windows 2000, python 2.4.3) and it works. However when i try popen2 and my pg_dump command, it prompts

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
Thanks /F, that was it. Dan On Sat, 18 Nov 2006 15:03:30 +0100, Fredrik Lundh <[EMAIL PROTECTED]> wrote: [snip] >p.stdin is the *other* process' stdin. if you want to read things it >prints, read from p.stdout instead. > >> print fin.readline() >> fin.close() > > -- http://mail.python.org/m

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread Fredrik Lundh
Daniel Klein wrote: > Now here is my attempt to use the 'subprocess' module : > > from subprocess import * > p = Popen(r'c:\home\hw.exe', bufsize=-1, stdin=PIPE, stdout=PIPE, > universal_newlines=True) > fin = p.stdin p.stdin is the *other* process' stdin. if you want to read things it prints,

Re: Having trouble converting popen2 to subprocess

2006-11-18 Thread tom
Daniel Klein wrote: > Here's a c routine that prints a single line : > > #include > main() > { > printf ("Hello World!\n"); > } > > And now the Python program (called 'po.py') that uses 'popen2' : > > import popen2 > (fin,

Having trouble converting popen2 to subprocess

2006-11-18 Thread Daniel Klein
Here's a c routine that prints a single line : #include main() { printf ("Hello World!\n"); } And now the Python program (called 'po.py') that uses 'popen2' : import popen2 (fin, fout) = popen2.popen2(r'c:\home\hw.exe', -1, 't') print fi

Re: Will subprocess eventually deprecate popen2 ?

2006-11-16 Thread Fredrik Lundh
Daniel Klein wrote: >I have a few Python programs that use popen2, and they work quite > nicely and dependably, so I don't really have any reason to change > them to use the new subprocess module...unless of course there any > future plans to deprecate popen2. definitely not

Will subprocess eventually deprecate popen2 ?

2006-11-16 Thread Daniel Klein
I have a few Python programs that use popen2, and they work quite nicely and dependably, so I don't really have any reason to change them to use the new subprocess module...unless of course there any future plans to deprecate popen2. Is this something I will have to plan for ? --

Re: popen2 question

2006-06-25 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, David Bear <[EMAIL PROTECTED]> wrote: >I'm using popen2 and getting an extra 1 at the end of my output. I didn't >see where this was explained in the docs so I clearly don't understand the >behavior. My code is si

popen2 question

2006-06-21 Thread David Bear
I'm using popen2 and getting an extra 1 at the end of my output. I didn't see where this was explained in the docs so I clearly don't understand the behavior. My code is simple. (input, output) = os.popen2('whackyperlprogram') results = output.read() rc = output.c

Re: buffers readlines and general popen2 confusion...

2006-05-20 Thread [EMAIL PROTECTED]
That's just it. I was hoping to have python listening for events and responding continually according to the demaons stdout. That's why I mention popen2. -- http://mail.python.org/mailman/listinfo/python-list

Re: buffers readlines and general popen2 confusion...

2006-05-20 Thread Jim Segrave
every few seconds >or can this be done a better way. I'm hoping for a more elegant >solution. So far I've seen some troubling info about buffer overflows >with popen2 but it looks like the low-hanging fruit. I'm not a unixpro >so I want to make sure anything I tackle is b

Re: buffers readlines and general popen2 confusion...

2006-05-20 Thread Larry Bates
I'm hoping for a more elegant > solution. So far I've seen some troubling info about buffer overflows > with popen2 but it looks like the low-hanging fruit. I'm not a unixpro > so I want to make sure anything I tackle is best practice. Suggestions > welcomed. > > -Ar

buffers readlines and general popen2 confusion...

2006-05-20 Thread [EMAIL PROTECTED]
o far I've seen some troubling info about buffer overflows with popen2 but it looks like the low-hanging fruit. I'm not a unixpro so I want to make sure anything I tackle is best practice. Suggestions welcomed. -Aris -- http://mail.python.org/mailman/listinfo/python-list

Re: trying to use popen2() to communicate with C program

2006-03-28 Thread I. Myself
Dennis Lee Bieber wrote: > On Tue, 28 Mar 2006 18:02:46 GMT, "I. Myself" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> The compile C program, commer.exe, writes a line of text to its stdout. >> The python program does not receive it; it never gets to print "Got here

Re: trying to use popen2() to communicate with C program

2006-03-28 Thread I. Myself
Rene Pijlman wrote: > I. Myself: > >> I can't get this to work >> > > With what versions of what software on what platform? > I'm glad you asked. really! Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Windows 2000. AMD processor. mingw compiler. Mitche

Re: trying to use popen2() to communicate with C program

2006-03-28 Thread Rene Pijlman
I. Myself: >I can't get this to work With what versions of what software on what platform? -- René Pijlman -- http://mail.python.org/mailman/listinfo/python-list

trying to use popen2() to communicate with C program

2006-03-28 Thread I. Myself
I can't get this to work: # commer.py - to test communication with other process from popen2 import popen2 (child_stdout, child_stdin) = popen2("commer.exe") print "Got here 1" line = child_stdout.readline() print "Got here 2" child_stdin.write(line) child_

Re: don't understand popen2

2006-03-24 Thread Kent Johnson
Sion Arrowsmith wrote: > Kent Johnson <[EMAIL PROTECTED]> wrote: > >>Sion Arrowsmith wrote: >> >>>(and please avoid the abuse of raw strings for Windows paths). >> >>Why do you consider that abuse of raw strings? > > I consider it abuse because it's not what they were invented for. > I consider

Re: don't understand popen2

2006-03-24 Thread Sion Arrowsmith
Kent Johnson <[EMAIL PROTECTED]> wrote: >Sion Arrowsmith wrote: >> (and please avoid the abuse of raw strings for Windows paths). >Why do you consider that abuse of raw strings? I consider it abuse because it's not what they were invented for. I consider discouraging it to be a good thing in orde

Re: don't understand popen2

2006-03-23 Thread Kent Johnson
Sion Arrowsmith wrote: > Try: > std_out, std_in = popen2.popen2("F:/coding/pwSync/popen_test/testia.py") > or: > std_out, std_in = popen2.popen2("F:\\coding\\pwSync\\popen_test\\testia.py") > (and please avoid the abuse of raw strings for Windows paths). Wh

Re: don't understand popen2

2006-03-23 Thread Fredrik Lundh
Sion Arrowsmith wrote: "F:\coding\pwSync\popen_test\testia.py" > 'F:\\coding\\pwSync\\popen_test\testia.py' this might make it more obvious that something's not quite right with that string literal: >>> print "F:\coding\pwSync\popen_test\testia.py" F:\coding\pwSync\popen_test es

Re: don't understand popen2

2006-03-23 Thread Sion Arrowsmith
Martin P. Hellwig <[EMAIL PROTECTED]> wrote: >std_out, std_in = popen2.popen2("F:\coding\pwSync\popen_test\testia.py") ^^ Your problem is, I suspect, nothing to do with popen2(), which is supported by the fact that t

Re: don't understand popen2

2006-03-23 Thread Martin P. Hellwig
with, but I'm still curious how to get this working on NT. I posted my new code and the results under my sep. -- mph popen_test.py---- #! /usr/local/bin/python import popen2 std_out, std_in = popen2.popen2("F:\coding\pwSync\popen_test\testia.py") s

Re: don't understand popen2

2006-03-22 Thread Martin P. Hellwig
gry@ll.mit.edu wrote: > > You gave it a single string, not a list(sequence) of strings. Try > something like: > std_in.writelines(["notgood"]) > I got this output then: >>> something: Traceback (most recent call last): File "F:\coding\pwSync\popen_test\popen_test.py", line 8, in ?

Re: don't understand popen2

2006-03-22 Thread Donn Cave
Quoth gry@ll.mit.edu: | Martin P. Hellwig wrote: ... |> import popen2 |> |> std_out, std_in = popen2.popen2("testia.py") |> |> x=std_out.readline() |> print(x) |> |> std_in.writelines("notgood") |> |> x=std_out.readline() |> print(x) ... |>

Re: don't understand popen2

2006-03-22 Thread gry
Martin P. Hellwig wrote: > Hi all, > > I was doing some popen2 tests so that I'm more comfortable using it. > I wrote a little python script to help me test that (testia.py): > > - > someline = raw_input("something:") > >

don't understand popen2

2006-03-22 Thread Martin P. Hellwig
Hi all, I was doing some popen2 tests so that I'm more comfortable using it. I wrote a little python script to help me test that (testia.py): - someline = raw_input("something:") if someline == 'test': print(&quo

popen2() does not work correctly on windows!

2006-02-21 Thread Peter Cai
I want to catch the output of a program but I can not use redirect because it's interactive and thus I need to see the output on the screen. So I use popen2() to execute it and then both print the output on the screen and in a log file. But when I want to write something command to it, it

Re: popen2

2005-10-30 Thread Piet van Oostrum
> Piet van Oostrum <[EMAIL PROTECTED]> (PvO) wrote: >PvO> He didn't state that he has no control over that program. I.e. if it is a >PvO> program that he has source code of, he could change its behaviour to use a >PvO> named pipe. He could do the initial run of the program with stdin and stdo

Re: popen2

2005-10-30 Thread Piet van Oostrum
> Grant Edwards <[EMAIL PROTECTED]> (GE) wrote: >GE> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >GE> That would require that the application know about the named >GE> pipe and open it. I don't think there is any way to swap a >GE> pipe in for stdin/stdout once a process is run

Re: popen2

2005-10-29 Thread Grant Edwards
On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>GE> That would require that the application know about the named >>GE> pipe and open it. I don't think there is any way to swap a >>GE> pipe in for stdin/stdout once a process is running. > > Sure. 'myprogram' should be designed to comm

Re: popen2

2005-10-29 Thread Piet van Oostrum
>>>>> Grant Edwards <[EMAIL PROTECTED]> (GE) wrote: >GE> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>>>> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: >>> >gf> If starts a process with p

Re: popen2

2005-10-29 Thread Donn Cave
Quoth Pierre Hanser <[EMAIL PROTECTED]>: | Grant Edwards a écrit : |> On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: |>>>>>>>"g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: |>> |>>>gf> If starts a process with popen2

Re: popen2

2005-10-29 Thread Pierre Hanser
Grant Edwards a écrit : > On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > >>>>>>>"g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: >> >>>gf> If starts a process with popen2.popen3('myprogram') and myprogram.e

Re: popen2

2005-10-29 Thread Grant Edwards
On 2005-10-29, Piet van Oostrum <[EMAIL PROTECTED]> wrote: >>>>>> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: > >>gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is >>gf> running before, I'

Re: popen2

2005-10-29 Thread Piet van Oostrum
>>>>> "g.franzkowiak" <[EMAIL PROTECTED]> (gf) wrote: >gf> If starts a process with popen2.popen3('myprogram') and myprogram.exe is >gf> running before, I've a connection to the second process, not to the first. >gf> I can find

Re: popen2

2005-10-28 Thread g.franzkowiak
David Wahler schrieb: > g.franzkowiak wrote: > >>I start a process in my application with popen2.popen3('MyOtherProcess'). >>That's ok, but what can I do if the other process is running ? >>Can I fetch some information and start with that ? >> >>

Re: popen2

2005-10-28 Thread David Wahler
g.franzkowiak wrote: > I start a process in my application with popen2.popen3('MyOtherProcess'). > That's ok, but what can I do if the other process is running ? > Can I fetch some information and start with that ? > > gerd It's not clear what you'

popen2

2005-10-28 Thread g.franzkowiak
I start a process in my application with popen2.popen3('MyOtherProcess'). That's ok, but what can I do if the other process is running ? Can I fetch some information and start with that ? gerd -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with select.poll and popen2

2005-08-30 Thread Magnus Lycka
Magnus Lycka wrote: > I'm trying to read standard out in a process started with popen2 > in a non-blocking way. (Other good ways of doing this than the > one I tried are appreciated.) I'm starting to get on top of this. First of all, I was confused by POLLIN and POLLOUT, sinc

Problem with select.poll and popen2

2005-08-30 Thread Magnus Lycka
I'm trying to read standard out in a process started with popen2 in a non-blocking way. (Other good ways of doing this than the one I tried are appreciated.) I've tried to dumb down my code to see what happens, and socket.poll seems to behave very strangely. I've tried to use the .

Examples and tutorials about popen2/3, smtplib/multipart and icq/jabber?

2005-08-09 Thread Alessandro Bottoni
Is there any good tutorial/example about popen2 and popen3? I have to execute a given command on Linux and Windows from within a Python program. If possible, on Linux I would like to be able to set the executing user (setuid) and the niceness level of the command. (and yes: I know it is a

Re: popen2 usage

2005-07-21 Thread jb
at user would type Thanks, -JB Steven Bethard wrote: > jb wrote: > > Hi there: > > > > I need help with popen2 usage. I am coding on Windows 2000 environment > > and I am basically trying to run command line executable program that > > accepts command line arg

Re: popen2 usage

2005-07-19 Thread Steven Bethard
jb wrote: > Hi there: > > I need help with popen2 usage. I am coding on Windows 2000 environment > and I am basically trying to run command line executable program that > accepts command line arguments from user. I want to be able to provide > these arguments through

popen2 usage

2005-07-19 Thread jb
Hi there: I need help with popen2 usage. I am coding on Windows 2000 environment and I am basically trying to run command line executable program that accepts command line arguments from user. I want to be able to provide these arguments through input pipe so that executable does not require any

Re: popen2 psql

2005-05-03 Thread Mage
you look >in the ~/.psql_history file? > > > Thank you. I will check but what about the python scripts? Why can't I read their *print* output with popen2? Mage -- http://mail.python.org/mailman/listinfo/python-list

Re: popen2 psql

2005-05-02 Thread Klaus Alexander Seistrup
Mage wrote: > I tried to write a proxy script for "psql" command. I need some > query log. I failed to read from the file object. The psql command is probably linked against readline; did you look in the ~/.psql_history file? Cheers, -- Klaus Alexander Seistrup Magnetic Ink, Copenhagen, Denmar

popen2 psql

2005-05-02 Thread Mage
pen2('./pto.py') for s in b.readlines(): print s, popen2 works with 'ls' but it doesn't output anything with the './pto.py'. The 'pto.py' is an existing python script and contains some print. Likely I have the same problem with popening the python scri

Re: popen2.Popen3 doesn't work well for me

2005-03-09 Thread Steven Bethard
alexrait1 wrote: It does but that's not what I want. I need a class which I can query for process termination for instance... Is there a way to overcome this problem with Popen3? If you're using Python 2.4 you should look into the subprocess module. I think these docs might be what you're looking

Re: popen2.Popen3 doesn't work well for me

2005-03-09 Thread alexrait1
It does but that's not what I want. I need a class which I can query for process termination for instance... Is there a way to overcome this problem with Popen3? -- http://mail.python.org/mailman/listinfo/python-list

Re: popen2.Popen3 doesn't work well for me

2005-03-09 Thread Steve Holden
alexrait1 wrote: I launch my python. Then I write this: import popen2 popen2.Popen3("mplayer *.mpg") it starts playing for 2 seconds.. and then stops... if I quit python (ctrl - D) mplayer continues to run and plays music as it should... Any ideas? It looks like the process you start i

popen2.Popen3 doesn't work well for me

2005-03-09 Thread alexrait1
I launch my python. Then I write this: import popen2 popen2.Popen3("mplayer *.mpg") it starts playing for 2 seconds.. and then stops... if I quit python (ctrl - D) mplayer continues to run and plays music as it should... Any ideas? -- http://mail.python.org/mailman/listinfo/python-list

Re: curl and popen2

2005-02-01 Thread Robey Holderith
On Tue, 01 Feb 2005 17:48:53 -0800, lists04 wrote: > Hi, > > I have a problem with a curl request and running it under popen2. > > If I run this request from the command line: > curl -i http://www.yahoo.com/test --stderr errfile > (also tried redirecting stdderr to a file

curl and popen2

2005-02-01 Thread lists04
Hi, I have a problem with a curl request and running it under popen2. If I run this request from the command line: curl -i http://www.yahoo.com/test --stderr errfile (also tried redirecting stdderr to a file 2>, nothing) the file errfile is empty indicating no error with the request. Howe

Re: popen2, 3, 4 -- will closing all returned streams result in process termination?

2004-12-28 Thread Jean Brouwers
mbies, you should call the poll() or wait() method of the Popen3 object created for each spawned process or call os.waitpid(). The problem is that the popen* functions only return the pipe objects and not the Popen3 instance nor the process id. Take a look at the source code of the popen2 module wh

Re: popen2, 3, 4 -- will closing all returned streams result in process termination?

2004-12-28 Thread Paul Rubin
[EMAIL PROTECTED] (Evgeni Sergeev) writes: > Is there assurance that the process will terminate and not sit > in memory orphaned, waiting on its stdin, for example? The process should receive an EOF. It will typically handle EOF by terminating, but that is not guaranteed. -- http://mail.python.o

popen2, 3, 4 -- will closing all returned streams result in process termination?

2004-12-28 Thread Evgeni Sergeev
After I opened streams to a process using popen2, popen3 or popen4, will closing every one of the streams terminate the process? Is there assurance that the process will terminate and not sit in memory orphaned, waiting on its stdin, for example? Evgeni Sergeev -- http://mail.python.org