Earl Lapus writes:
> Hi,
>
> I made simple test program using the subprocess module (see attached:
> exec_cmd.py). I ran it passing variations of 'ls' command options.
>
> I encounter exceptions every time I use '-l' options. Example runs
> where exception occurs:
> # ./exec_cmd.py ls -al
> # ./e
On Mon, Sep 1, 2014 at 6:46 PM, Cameron Simpson wrote:
> Not really. If the arguments are coming in from the command line, someone (a
> user, even if that user is the programmer) typed them. Even if not
> malicious, they can still be mistaken. Or just unfortunate.
I'm guessing that what he means
On 01Sep2014 14:33, Earl Lapus wrote:
On Mon, Sep 1, 2014 at 1:39 PM, Chris Angelico wrote:
Glad it's working! But please, don't just take my word for it and make
a black-box change to your code. When you invoke subprocesses, be sure
you understand what's going on, and when shell=True is appro
On Mon, Sep 1, 2014 at 1:39 PM, Chris Angelico wrote:
>
> Glad it's working! But please, don't just take my word for it and make
> a black-box change to your code. When you invoke subprocesses, be sure
> you understand what's going on, and when shell=True is appropriate and
> when shell=False is a
On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico wrote:
>
> But secondly, you're already splitting the argument (or rather, taking
> it from your own parameters, already split), so you don't want to go
> through the shell. In fact, going through the shell would only make
> your life harder. Change
On Mon, Sep 1, 2014 at 3:24 PM, Earl Lapus wrote:
> On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico wrote:
>>
>> But secondly, you're already splitting the argument (or rather, taking
>> it from your own parameters, already split), so you don't want to go
>> through the shell. In fact, going thro
On Mon, Sep 1, 2014 at 1:28 PM, Earl Lapus wrote:
> So, what could be causing this behavior? Is this expected or is there
> something wrong with how I'm using the subprocess module?
The latter. Your problem is with your shell= option.
Firstly, the parameter should be either shell=True or shell=F
On Fri, 20 Jan 2012 08:42:16 -0600, skip wrote:
> The library documentation doesn't talk a lot about long-lived subprocesses
> other than the possibility of deadlock when using Popen.wait(). Ideally, I
> would write to the subprocess's stdin, check for output on stdout and
> stderr, then lather,
(Apologies for the non-threaded reply. My subscription to the list is
currently set to no-mail and I can't get to gmane.org, so have no clean way
to reply...)
Mike Fletcher wrote:
> Definitely *will* block, you have to explicitly set them non-blocking to
> have non-blocking behaviour:
...
>
On 12-01-20 09:42 AM, s...@pobox.com wrote:
> I'm converting some os.popen calls to use subprocess.Popen. I had
> previously been ignoring stdout and stderr when using os.popen. The primary
> motivation to switch to subprocess.Popen now is that I now want to check
> stderr, so would have to make
On Tue, Jul 27, 2010 at 4:12 PM, Timothy W. Grove wrote:
> I am using the following code to hide the console window when launching a
> subprocess under Windows.
>
> startupinfo = subprocess.STARTUPINFO()
> startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
> startupinfo.wShow
On 2009-03-14 20:10:29 -0400, Karthik Gurusamy said:
On Mar 14, 3:03 am, Roman Medina-Heigl Hernandez
wrote:
Karthik Gurusamy escribió:
On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
wrote:
Hi,
I'm experimenting with Python and I need a little help with this. What
I'd
like is to
On Mar 14, 3:03 am, Roman Medina-Heigl Hernandez
wrote:
> Karthik Gurusamy escribió:
>
>
>
> > On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
> > wrote:
> >> Hi,
>
> >> I'm experimenting with Python and I need a little help with this. What I'd
> >> like is to launch an interactive shell, having
Karthik Gurusamy escribió:
> On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
> wrote:
>> Hi,
>>
>> I'm experimenting with Python and I need a little help with this. What I'd
>> like is to launch an interactive shell, having the chance to send first
>> several commands from python. I've written th
On Mar 13, 6:39 pm, Roman Medina-Heigl Hernandez
wrote:
> Hi,
>
> I'm experimenting with Python and I need a little help with this. What I'd
> like is to launch an interactive shell, having the chance to send first
> several commands from python. I've written the following code:
>
> =
On Thu, Feb 26, 2009 at 2:41 AM, Visco Shaun wrote:
> hi all
>
> while getting used to with subprocess module i failed in executuing a)
> but succeeded in running b). Can anyone explain me why as i am providing
> absolute path? Is this has to do anything with shared library.. which
> must be acces
Visco Shaun schrieb:
> hi all
>
> while getting used to with subprocess module i failed in executuing a)
> but succeeded in running b). Can anyone explain me why as i am providing
> absolute path? Is this has to do anything with shared library.. which
> must be accessed based on system variables?
En Tue, 19 Aug 2008 22:06:13 -0300, aditya shukla
<[EMAIL PROTECTED]> escribi�:
I am using windows vista and i am trying to communicate with various
processes.
so when i do
import subprocess
proc=subprocess.Popen('cmd.exe')
--This opens the command prompt
But when i do
proc=subprocess.Popen(
Peter Otten <[EMAIL PROTECTED]>:
> - communicate() waits for the subprocess to terminate.
> - stdout.read() is retried if an EINTR occurs (Not sure when this would
> happen).
EINTR happens, if the "read" syscall is interrupted by a signal handler.
For instance, if a daemon handles SIGUSR to re-r
On Jul 14, 7:44 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> John Mechaniks wrote:
> > On Jul 14, 12:34 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> >> John Mechaniks wrote:
> >> > from subprocess import call
> >> > call(['ls', '-l'])
>
> >> > How do I get the result (not the exit status of the com
John Mechaniks wrote:
> On Jul 14, 12:34 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
>> John Mechaniks wrote:
>> > from subprocess import call
>> > call(['ls', '-l'])
>>
>> > How do I get the result (not the exit status of the command) of "ls -
>> > l" into a variable?
>>
>> output = subprocess.Pop
On Jul 14, 12:34 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> John Mechaniks wrote:
> > from subprocess import call
> > call(['ls', '-l'])
>
> > How do I get the result (not the exit status of the command) of "ls -
> > l" into a variable?
>
> output = subprocess.Popen(["ls", "-l"], stdout=subproces
On 14 Lug, 10:34, Peter Otten <[EMAIL PROTECTED]> wrote:
> John Mechaniks wrote:
> > from subprocess import call
> > call(['ls', '-l'])
>
> > How do I get the result (not the exit status of the command) of "ls -
> > l" into a variable?
>
> output = subprocess.Popen(["ls", "-l"], stdout=subprocess.P
John Mechaniks wrote:
> from subprocess import call
> call(['ls', '-l'])
>
> How do I get the result (not the exit status of the command) of "ls -
> l" into a variable?
output = subprocess.Popen(["ls", "-l"], stdout=subprocess.PIPE).stdout.read()
Peter
--
http://mail.python.org/mailman/listinfo
[EMAIL PROTECTED] schrieb:
> Hello all
>
> I want to convert a tex file into a pdf by using pdflatex. For that, I
> thought the 'subprocess' module might be a good option. My code doesn't work
> at all tho:
>
> Import os, subprocess
>
> def main():
> scriptpath = os.path.dirname(__file
[EMAIL PROTECTED] schrieb:
Hello all
I want to convert a tex file into a pdf by using pdflatex. For that, I thought
the 'subprocess' module might be a good option. My code doesn't work at all tho:
Import os, subprocess
def main():
scriptpath = os.path.dirname(__file__)
p = su
On 23 Apr, 13:17, Harishankar <[EMAIL PROTECTED]> wrote:
> On Wednesday 23 Apr 2008 15:11:21 Ben Kaplan wrote:
> > I don't know about all Linux distros, but my Ubuntu machine (8.04 Beta),
> > has the 'TERM' (xterm) and 'COLORTERM' (gnome-terminal) keys in os.environ.
> > You might be able to use th
Mike Hansen <[EMAIL PROTECTED]> wrote:
> > I think the best solution would be to port Pexpect to windows which
> > wouldn't be that difficult according to my reading of the code. If
> > only I had more free time!
>
> Sage ( http://www.sagemath.org ) uses pexpect fairly extensively to
> interfac
> I think the best solution would be to port Pexpect to windows which
> wouldn't be that difficult according to my reading of the code. If
> only I had more free time!
Sage ( http://www.sagemath.org ) uses pexpect fairly extensively to
interface with all sorts of other systems. We recently recei
On Apr 22, 12:52 pm, Harishankar <[EMAIL PROTECTED]> wrote:
> Sorry to start off on a negative note in the list, but I feel that the Python
> subprocess module is sorely deficient because it lacks a mechanism to
Have you looked at the processing module in cheese shop?
--
http://mail.python.org/m
On Tuesday 22 Apr 2008 17:54:00 Nicola Musatti wrote:
> I suggest you check out this:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
>
> Cheers,
> Nicola Musatti
> --
> http://mail.python.org/mailman/listinfo/python-list
An interesting solution. Thanks a lot for the link.
--
Re
On Apr 22, 12:52 pm, Harishankar <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sorry to start off on a negative note in the list, but I feel that the Python
> subprocess module is sorely deficient because it lacks a mechanism to:
>
> 1. Create non-blocking pipes which can be read in a separate thread (I am
On Tuesday 22 Apr 2008 17:06:26 Paul Boddie wrote:
> On 22 Apr, 12:52, Harishankar <[EMAIL PROTECTED]> wrote:
> > Is there any way to use non-blocking Popen objects using subprocess? and
> > 2 - is there a way to kill the subprocess in a platform independent
> > manner in a purely Pythonic way? I t
On 22 Apr, 12:52, Harishankar <[EMAIL PROTECTED]> wrote:
>
> Is there any way to use non-blocking Popen objects using subprocess? and 2 -
> is there a way to kill the subprocess in a platform independent manner in a
> purely Pythonic way? I thought initially that this problem is simple enough,
> bu
Thanks! That worked perfectly.
Matt
On Sep 7, 10:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Fri, 07 Sep 2007 18:46:26 -0300, Matthew Lausch <[EMAIL PROTECTED]>
> escribi?:
>
> > I'd like to use thesubprocessmodule with upper level characters in
> > the process name or in the argume
En Fri, 07 Sep 2007 18:46:26 -0300, Matthew Lausch <[EMAIL PROTECTED]>
escribi�:
> I'd like to use the subprocess module with upper level characters in
> the process name or in the arguments to the process. Something like
> this:
>
> cmd = [ u'test_\u65e5\u672c\u8a9e_exec.bat', u'arg1', u'arg2'
placid <[EMAIL PROTECTED]> wrote:
> >>> import subprocess
> >>> p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5
> >>> -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subprocess.PIPE)
>
> but the ffmpeg complains about the input file being corrupter, whereas
> when i
"placid" <[EMAIL PROTECTED]> wrote:
>Hi all,
>
>If someone could give me an example of creating a subprocess (on
>Windows) using the subprocess module and Popen class and connecting to
>its stdout/stdin file handles. I googled for a bit but the only example
>i found was here ;
"Use the source, Lu
--On 2. November 2005 08:48:24 -0800 Ernesto <[EMAIL PROTECTED]> wrote:
This worked for me on XP... not sure for 98...
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409002
Thanks, this works!
Andreas
pgpeWK0kWa6KX.pgp
Description: PGP signature
--
http://mail.python.org/mailman
This worked for me on XP... not sure for 98...
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/409002
--
http://mail.python.org/mailman/listinfo/python-list
Dieter Maurer wrote:
.
>
> You just found out that this is not the case.
thanks I suppose I was being a moron.
>
> The warning attached to "communicate"s docstring might have
> you averted: "Note: the data read is buffered in memory...
> do not use for large size".
>
> If subprocess would
Robin Becker <[EMAIL PROTECTED]> writes on Sun, 12 Jun 2005 09:22:52 +:
> I'm using a polling loop in a thread that looks approximately like this
>
> while 1:
> p = find_a_process()
> rc = p.poll()
> if rc is not None:
> out, err = p.communicate()
> #deal with
42 matches
Mail list logo