Re: [Tutor] subprocess.Popen()

2018-12-03 Thread Dave Hill
The combination of installing Python 3.7 on RasPi and removing the StringIO() cures the error. I now get the statistics and the 'have a nice day' output from omxplayer. I just need to find out how to invoke the idle 3.7, rather than idle 3.5, but I think that is a question for the RasPi forum.

Re: [Tutor] subprocess.Popen()

2018-12-03 Thread Dave Hill
I had not spotted that! It appears that, although I have 3.7 on my laptop, 3.7 is not a part of the latest standard Raspbian release. I will install this later today and try again. Dave On 03/12/2018 10:12, Alan Gauld via Tutor wrote: On 02/12/2018 10:29, Dave Hill wrote: Having 'graduated'

Re: [Tutor] subprocess.Popen()

2018-12-03 Thread Mats Wichmann
On 12/2/18 3:29 AM, Dave Hill wrote: > Having 'graduated' to Python 3.7, I thought I would explore > subprocess.Popen, and put the code in a Class, see code below. The video > runs, but an error occurs, which I do not understand, see further below the error happens in the except clause of your tr

Re: [Tutor] subprocess.Popen()

2018-12-03 Thread Alan Gauld via Tutor
On 02/12/2018 10:29, Dave Hill wrote: > Having 'graduated' to Python 3.7, I thought I would explore > Traceback (most recent call last): >File "/home/pi/Code/TestVideo#4.py", line 31, in > player.playVideo(FILE, 'HDMI') >File "/home/pi/Code/VideoPlayer.py", line 51, in playVideo >

[Tutor] subprocess.Popen()

2018-12-02 Thread Dave Hill
I am a volunteer at a Heritage Railway in N.Wales and, amongst other things, I provide electronics and software for various exhibits in the museum. I use the Raspberry Pi to provide various video presentations, employing the omxplayer. I am in the process of updating an application known as th

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-31 Thread Cameron Simpson
On 31Mar2017 06:13, eryk sun wrote: On Thu, Mar 30, 2017 at 10:51 PM, Cameron Simpson wrote: This suggests that .communicate uses Threads to send and to gather data independently, and that therefore the deadlock situation may not arise. For Unix, communicate() uses select or poll. It uses th

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-31 Thread bruce
Cameron!!! You are 'da man!! Read your exaplanation.. good stuff to recheck/test and investigate over time In the short term, I'll implement some tests!! thanks! On Thu, Mar 30, 2017 at 6:51 PM, Cameron Simpson wrote: > I wrote a long description of how .communicate can deadlock. > > The

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread eryk sun
On Thu, Mar 30, 2017 at 10:51 PM, Cameron Simpson wrote: > This suggests that .communicate uses Threads to send and to gather data > independently, and that therefore the deadlock situation may not arise. For Unix, communicate() uses select or poll. It uses threads on Windows. Either way it avoid

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread Cameron Simpson
I wrote a long description of how .communicate can deadlock. Then I read the doco more carefully and saw this: Warning: Use communicate() rather than .stdin.write, .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process

Re: [Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread Cameron Simpson
On 30Mar2017 13:51, bruce wrote: Trying to understand the "correct" way to run a sys command ("curl") and to get the potential stderr. Checking Stackoverflow (SO), implies that I should be able to use a raw/text cmd, with "shell=true". I strongly recommend avoiding shell=True if you can. It ha

[Tutor] subprocess.Popen / proc.communicate issue

2017-03-30 Thread bruce
Trying to understand the "correct" way to run a sys command ("curl") and to get the potential stderr. Checking Stackoverflow (SO), implies that I should be able to use a raw/text cmd, with "shell=true". If I leave the stderr out, and just use s=proc.communicate() the test works... Any pointe

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-05-01 Thread eryksun
On Fri, May 1, 2015 at 8:03 AM, Albert-Jan Roskam wrote: > I used a str for cmd because I found it more readable that way. I could do > cmd.split(). Don't use cmd.split(). That just splits on whitespace without respecting how the shell tokenizes the command. Use shlex.split(cmd) instead. > So o

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-05-01 Thread Albert-Jan Roskam via Tutor
On Thu, Apr 30, 2015 1:12 AM CEST eryksun wrote: >On Wed, Apr 29, 2015 at 11:54 AM, Albert-Jan Roskam > wrote: >> Hmmm, that sounds pretty convincing indeed (makes it even stranger that CD >> works the way it works). >> I believe it threw a WindowsError, indicating t

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-30 Thread Alan Gauld
On 30/04/15 01:48, eryksun wrote: > Actually cmd.exe is fine with UNC paths. cmd.exe cannot use a UNC path as the current directory. Oops, my mistake. I got my POSIX and UNC mixed up. I was thinking about forward slashes etc not network names. Apologies for not reading the message properly. --

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 8:28 PM, eryksun wrote: > After disabling the check, my previous example should work fine: Except it doesn't accept paths relative to a UNC working directory: (test) \\127.0.0.1\C$>cd Temp The system cannot find the path specified. And the cd command appears to i

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 7:48 PM, eryksun wrote: > cmd.exe was developed for OS/2 (1987) to replace COMMAND.COM (1981). Actually, I stand corrected about the reason being cmd's 1980s crustiness. Per [KB156276][1] this check was added to NT 4.0 (1996) to address a vaguely described problem ("a UNC

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 7:08 PM, Alan Gauld wrote: > On 30/04/15 00:12, eryksun wrote: > >> the working directory, but the cmd.exe shell (being a crusty relic of >> the 1980s) does not. > > Actually cmd.exe is fine with UNC paths. It's only when you > combine them with Windows /option style that i

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Alan Gauld
On 30/04/15 00:12, eryksun wrote: the working directory, but the cmd.exe shell (being a crusty relic of the 1980s) does not. Actually cmd.exe is fine with UNC paths. It's only when you combine them with Windows /option style that it has issues but even then putting the path in quotes will usua

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread eryksun
On Wed, Apr 29, 2015 at 11:54 AM, Albert-Jan Roskam wrote: > Hmmm, that sounds pretty convincing indeed (makes it even stranger that CD > works the way it works). > I believe it threw a WindowsError, indicating that the file(s) could not be > found, because the dir was > not changed. I actually

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Albert-Jan Roskam
- On Wed, Apr 29, 2015 4:11 PM CEST Peter Otten wrote: >Albert-Jan Roskam wrote: > >> Hello, >> >> Windows has the 'feature' that the CD command does not work with UNC >> paths. So in the code below, I cannot use the 'cwd' parameter of >> subprocess.Popen. Therefore I

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Peter Otten
Albert-Jan Roskam wrote: > Hello, > > Windows has the 'feature' that the CD command does not work with UNC > paths. So in the code below, I cannot use the 'cwd' parameter of > subprocess.Popen. Therefore I use pushd/popd to accomplish the same > effect. Is there a better way to do this? (other th

Re: [Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Dave Angel
On 04/29/2015 08:47 AM, Albert-Jan Roskam wrote: Hello, Windows has the 'feature' that the CD command does not work with UNC paths. So in the code below, I cannot use the 'cwd' parameter of subprocess.Popen. Therefore I use pushd/popd to accomplish the same effect. Is there a better way to do t

[Tutor] subprocess.Popen(..., cwd) and UNC paths

2015-04-29 Thread Albert-Jan Roskam
Hello, Windows has the 'feature' that the CD command does not work with UNC paths. So in the code below, I cannot use the 'cwd' parameter of subprocess.Popen. Therefore I use pushd/popd to accomplish the same effect. Is there a better way to do this? (other than using full path names everywhere,

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
On 10/28/2014 04:27 PM, Todd wrote: > Centos has SELinux enabled by default. I dont know if SELinux is > causing your problem, but it is always worth looking at. > > SELinux can keep a process from accessing files or executing another > process. > > Try temporarily disabling SELinux by runnin

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Todd
Centos has SELinux enabled by default. I dont know if SELinux is causing your problem, but it is always worth looking at. SELinux can keep a process from accessing files or executing another process. Try temporarily disabling SELinux by running setenforce=0 as root. Then see if python does wha

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Alan Gauld
On 28/10/14 19:23, Adam Jensen wrote: platform. This is what I've discovered so far: | | CentOS-6.5 | OpenBSD-5.5 | DragonFly-3.8.2 | | bufsize | Python-3.4.1 | Python-3.3.2 | Python-3.3.3| |-+--+--+-

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
On 10/28/2014 02:32 PM, Alan Gauld wrote: > I tried -1 and 1 on my Lubuntu and it still works fine. > Definitely weird, it begins to look like a CentOS build issue > but what is CentOS doing different to Lubuntu/Suse/OpenBSD etc? > > From memory CentOS is basically a free version of Red Hat > Ent

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Alan Gauld
On 28/10/14 15:31, Adam Jensen wrote: - bufsize will be supplied as the corresponding argument to the open() function when creating the stdin/stdout/stderr pipe file objects: And I get these results (on CentOS-6.5-x86):

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
Update: On 10/27/2014 09:50 PM, Adam Jensen wrote: > What's weird is that I have two different python3.4 installations on > this CentOS-6.5 machine and both have the same behavior (script hangs > until Ctrl+C). > > I built this one (/opt/bin/python3.4) from source: ... > But this one (~/anaconda3

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 09:31 PM, Alan Gauld wrote: > On 27/10/14 20:26, Adam Jensen wrote: > >> That's a bit bizarre. I too have the execution bit set for both the >> python script and the shell script but the same (no joy) behavior occurs >> on both: > >> $ ./subprocess_pipe.py > > Its a long shot but

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Alan Gauld
On 27/10/14 20:26, Adam Jensen wrote: That's a bit bizarre. I too have the execution bit set for both the python script and the shell script but the same (no joy) behavior occurs on both: $ ./subprocess_pipe.py Its a long shot but try explicitly invoking the interpreter: $ python3 ./subpro

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Alan Gauld
On 28/10/14 01:05, Adam Jensen wrote: Thanks for giving it a try. The mailing list moderation delay is making an interactive conversation a bit difficult. Well, that much I can help with, you are now off moderation :-) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 03:40 PM, David Abbott wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere / >> somehow. Does anyone have any ideas about what it is that I might be >> misunderstanding? > > Works here.

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 07:12 PM, Alan Gauld wrote: > On 27/10/14 18:24, Adam Jensen wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere > > It works fine on my Lubuntu 14 with Python3.4. > > How exactly are

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 03:40 PM, David Abbott wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere / >> somehow. Does anyone have any ideas about what it is that I might be >> misunderstanding? > > Works here

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Alan Gauld
On 27/10/14 18:24, Adam Jensen wrote: It hangs at the print statement and, from the sound of the fans in the computer, I suspect it spirals off into an infinite loop somewhere It works fine on my Lubuntu 14 with Python3.4. How exactly are you running it? If I don't make parrot.sh executable I

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread David Abbott
I did do this also; david@heater ~/python_practice $ chmod a+x parrot.sh david@heater ~/python_practice $ chmod a+x subprocess_pipe.py ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/l

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread David Abbott
> It hangs at the print statement and, from the sound of the fans in the > computer, I suspect it spirals off into an infinite loop somewhere / > somehow. Does anyone have any ideas about what it is that I might be > misunderstanding? Works here. david@heater ~/python_practice $ ./subprocess_pipe

[Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
Hi, I'm exploring Popen today and I seem to be having some trouble deciphering the [documentation][1]. [1]: docs.python.org/3/library/subprocess.html#popen-constructor In this example (below), I expect to start a shell script as a separate process, send a line of text through a pipe (to the shell

Re: [Tutor] subprocess.Popen help

2014-01-29 Thread Mkhanyisi Madlavana
On 28 January 2014 21:52, leam hall wrote: > Python tutorial for 2.6 (using 2.4 -- don't ask), first code blurb under > 17.1.1 > > > http://docs.python.org/2.6/library/subprocess.html?highlight=subprocess#subprocess.Popen > > How would you make an ssh to another box put data back in "p"? The > go

Re: [Tutor] subprocess.Popen help

2014-01-28 Thread eryksun
On Tue, Jan 28, 2014 at 2:52 PM, leam hall wrote: > Python tutorial for 2.6 (using 2.4 -- don't ask), first code blurb under > 17.1.1 > > http://docs.python.org/2.6/library/subprocess.html?highlight=subprocess#subprocess.Popen > > How would you make an ssh to another box put data back in "p"? The

Re: [Tutor] subprocess.Popen help

2014-01-28 Thread Alan Gauld
On 28/01/14 19:52, leam hall wrote: Python tutorial for 2.6 (using 2.4 -- don't ask), first code blurb under 17.1.1 http://docs.python.org/2.6/library/subprocess.html?highlight=subprocess#subprocess.Popen How would you make an ssh to another box put data back in "p"? The goal is to run a shell

[Tutor] subprocess.Popen help

2014-01-28 Thread leam hall
Python tutorial for 2.6 (using 2.4 -- don't ask), first code blurb under 17.1.1 http://docs.python.org/2.6/library/subprocess.html?highlight=subprocess#subprocess.Popen How would you make an ssh to another box put data back in "p"? The goal is to run a shell command on a remote box and work with

Re: [Tutor] subprocess.Popen help...thanks

2012-08-22 Thread Ray Jones
Thanks to all who responded. I'm deeply into some of the links provided, and my understanding has greatly increased. Ray On 08/22/2012 12:59 AM, Andreas Perstinger wrote: > On 22.08.2012 03:39, Ray Jones wrote: >> Does anyone know of a link to a really good tutorial that would help me >> with s

Re: [Tutor] subprocess.Popen help

2012-08-22 Thread David Abbott
On Tue, Aug 21, 2012 at 9:39 PM, Ray Jones wrote: > > Does anyone know of a link to a really good tutorial that would help me > with subprocess.Popen? a tutorial that uses really small words and more > examples than explanation? After 15 years of scripting, I'm ashamed to > say that I'm still not

Re: [Tutor] subprocess.Popen help

2012-08-22 Thread Andreas Perstinger
On 22.08.2012 03:39, Ray Jones wrote: Does anyone know of a link to a really good tutorial that would help me with subprocess.Popen? a tutorial that uses really small words and more examples than explanation? After 15 years of scripting, I'm ashamed to say that I'm still not all that familiar wit

[Tutor] subprocess.Popen help

2012-08-21 Thread Ray Jones
Does anyone know of a link to a really good tutorial that would help me with subprocess.Popen? a tutorial that uses really small words and more examples than explanation? After 15 years of scripting, I'm ashamed to say that I'm still not all that familiar with input, output, pipes, etc. much beyon

Re: [Tutor] Subprocess.Popen process seems to be outputting to stdout even though redirected ?

2012-06-10 Thread dave selby
This list is amazing, I scratch my head, think and think then finally post a question, maybe its the act of spelling it out, ps ax showed 2 x 'tail' processes, I am guessing zombies of previous attempts, killed them, all works AOK now On 10 June 2012 10:06, dave selby wrote: > I have a simple sc

[Tutor] Subprocess.Popen process seems to be outputting to stdout even though redirected ?

2012-06-10 Thread dave selby
I have a simple script to tail a log file for an error string, it works AOK but there is an unexpected side effect, when I run it in a shell. if I echo "ERROR TEST" >> LOG in a separate shell, I get the following from the script ERROR TEST GOT YA :) ERROR TEST So it looks like I am getting std

Re: [Tutor] subprocess.Popen() OR subprocess.call() ?

2011-06-12 Thread Alan Gauld
"Neha P" wrote I am newbie and want to know what is the difference between subprocess.Popen() and subprocess.call() ? Simply speaking, call() is a way to make subprocess easier to use. Popen gives you much more powerful options but that flexibility means it's harder to use. when is it b

[Tutor] subprocess.Popen() OR subprocess.call() ?

2011-06-12 Thread Neha P
Hi all, I am newbie and want to know what is the difference between subprocess.Popen() and subprocess.call() ? when is it best to use each one? Any help appreciated!!  Regards, Neha___ Tutor maillist - Tutor@python.org To unsubscribe or change subsc