Re: [Tutor] Interacting with stderr

2014-08-31 Thread Alan Gauld
On 31/08/14 14:25, Crush wrote: Alan said, "... you are reassigning p in the middle of a loop that depends on p. That's usually not a good idea..." If not what I changed my code to, then I reckon I do not > understand what he is suggesting I do. Your original code looked like this: p = subpr

Re: [Tutor] Interacting with stderr

2014-08-31 Thread Crush
Alan said, "... you are reassigning p in the middle of a loop that depends on p. That's usually not a good idea..." If not what I changed my code to, then I reckon I do not understand what he is suggesting I do. I have to reparse stderr, each time test_loop.sh is executed the content of std

Re: [Tutor] Interacting with stderr

2014-08-30 Thread Cameron Simpson
On 30Aug2014 22:32, Crush wrote: Thank you Allan for your criticism. Please see the below changes. As far as the embedded loops, I know no other way to achieve the same out come. Regrettably I've lost Alan's email on that (I had it:-). It looks like you've taken he concern over nested use of

Re: [Tutor] Interacting with stderr

2014-08-30 Thread Crush
Ok, i understand the dangers of using root. I will bring this to the attention of the CTO of the company, which he should know already, but none the less. You must know though, I do not have the power to change the way things are done. If he says "ahhh, dont worry about it," then what am I to do

Re: [Tutor] Interacting with stderr

2014-08-30 Thread Danny Yoo
>>> One other thing: if you can avoid running commands as root, I'd >>> strongly suggest doing so. Your second screenshot shows that you're >>> running as root superuser, and the imaginary security demon that sits >>> on my left shoulder is laughing uproariously as we speak. >> >> Haha Yes I am aw

Re: [Tutor] interacting with stderr

2014-08-30 Thread Alan Gauld
On 30/08/14 23:31, Bo Morris wrote: time to a more appropriate amount. Anyone see any issues with it or ways to make it better? One obvious issue: while True: while count < 15: for line in p.stderr: > if "Segmentation" in line: while restart < 3

[Tutor] interacting with stderr

2014-08-30 Thread Bo Morris
Here is my working code. It works great in the lab, but I still need to test it on a live system. I also need to add the email notifications to it, but I purposely left them out for now; I will also adjust the sleep time to a more appropriate amount. Anyone see any issues with it or ways to make it

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Cameron Simpson
On 29Aug2014 18:35, Crush wrote: On Aug 29, 2014, at 6:12 PM, Danny Yoo wrote: One other thing: if you can avoid running commands as root, I'd strongly suggest doing so. Your second screenshot shows that you're running as root superuser, and the imaginary security demon that sits on my left sh

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Cameron Simpson
On 29Aug2014 18:31, Crush wrote: Ok so no links to dropbox? Man im confused...i thought links to dropbox were ok? That was my fault. I said: If your screenshot is inherently graphical, publish it elsewhere (eg save it to Dropbox and get a "public link") and mention the link in your post

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Crush
Haha Yes I am aware of people like you who are just itching to exploit vulnerabilities like that; however, the programs my company uses to broadcast will only run as root. Bo > On Aug 29, 2014, at 6:12 PM, Danny Yoo wrote: > > Hi Bo, > > One other thing: if you can avoid running commands a

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Crush
Ok so no links to dropbox? Man im confused...i thought links to dropbox were ok? Wow i feel like such an idiot haha. I should have caught that capitolization error! Im sorry to have waisted your time. Bo > On Aug 29, 2014, at 6:06 PM, Danny Yoo wrote: > >> On Fri, Aug 29, 2014 at 2:13 PM,

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Danny Yoo
Hi Bo, One other thing: if you can avoid running commands as root, I'd strongly suggest doing so. Your second screenshot shows that you're running as root superuser, and the imaginary security demon that sits on my left shoulder is laughing uproariously as we speak. __

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Danny Yoo
On Fri, Aug 29, 2014 at 2:13 PM, Crush wrote: > I am now able to print stderr to the screen, however I still can not run > conditional statements against stderr. > > Please see the screenshots(SS) here... > > https://www.dropbox.com/sh/31wyjtvqymo94uk/AAAZaxwB27nw1nmz7tz69I5La?dl=0 Hi Bo, Cons

Re: [Tutor] Interacting with stderr

2014-08-29 Thread Crush
I am now able to print stderr to the screen, however I still can not run conditional statements against stderr. Please see the screenshots(SS) here... https://www.dropbox.com/sh/31wyjtvqymo94uk/AAAZaxwB27nw1nmz7tz69I5La?dl=0 Bo > On Aug 28, 2014, at 6:12 PM, Cameron Simpson wrote: > >> On

Re: [Tutor] Interacting with stderr

2014-08-28 Thread Cameron Simpson
On 28Aug2014 09:42, Crush wrote: As far as the pipe in... "avconv -v verbose -re -analyzeduration 1000 -ihttp://localhost:6498/ms2/1382097438004/0MediaPlayer+0+/octoshape+hVV+octolive.americaone.com+V+aone+V+live+V+ONECONNXTDEMO1_HD_flv/aoneliveONECONNXTDEMO1HDflv -c:v rawvideo -c:a pcm_s16le

Re: [Tutor] Interacting with stderr

2014-08-28 Thread Crush
So, are yall done arguing haha...jk! Seriously, thank you for taking the time to pick this issue apart with me. Cameron your "learning" comment was right on; my ultimate goal in posting here is to learn and of course to figure out my code. As far as the pipe in... "avconv -v verbose -re -anal

Re: [Tutor] Interacting with stderr

2014-08-28 Thread Alan Gauld
On 28/08/14 07:30, Cameron Simpson wrote: On a tutor list, what's our stance on exploring the operation at a lower level so the OP gets a better feel for what's going on? I'm aware we don't need to agree on that stance:-) Its OK if the OP will understand it. Just explaining the detail of itse

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Cameron Simpson
On 27Aug2014 22:42, Danny Yoo wrote: Rather than construct the pipeline through the shell, do it through Python if you can. See: https://docs.python.org/2/library/subprocess.html#replacing-shell-pipeline But his use case is not using a shell pipeline, so irrelevant. It just makes things more

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Danny Yoo
>> Rather than construct the pipeline through the shell, do it through >> Python if you can. See: >> >> https://docs.python.org/2/library/subprocess.html#replacing-shell-pipeline > > But his use case is not using a shell pipeline, so irrelevant. It just makes > things more complex for him. Did I

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Cameron Simpson
On 27Aug2014 18:56, Danny Yoo wrote: Crude and incomplete and untested example: from subprocess import Popen, PIPE P = Popen("avconv ... lots of arguments...", shell=True, stderr=PIPE) for line in P.stderr: ... examine the line from stderr ... # ok, we have read all of stderr n

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Danny Yoo
> Crude and incomplete and untested example: > > from subprocess import Popen, PIPE > > P = Popen("avconv ... lots of arguments...", shell=True, stderr=PIPE) > > for line in P.stderr: > ... examine the line from stderr ... > > # ok, we have read all of stderr now > xit = P.wait() >

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Cameron Simpson
Before we proceed, two requests: Please do not top post. Post below, and trim the irrelevant content, so things read like a conversation. Please consider reading the list on an article-by-article basis instead of as a digest. You will get a better discussion view and we will see your messages

[Tutor] Interacting with stderr

2014-08-27 Thread Crush
> The vast majority of performance issues in software are to do with > blockages in IO processing(network, disk access, human input, etc) > or database processing (big data or complex searches) or in traversing > complex/deep data structures. Very few real-world performance issues &g

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Alan Gauld
On 27/08/14 23:45, Crush wrote: Hello, it has been a while and I hope I am sending to the correct email. How would I go about running a conditional statement against the contents of stderr. For instance, if "blah blah blah" is in stderr do X, else do Y. You can access stderr just like you acce

Re: [Tutor] Interacting with stderr

2014-08-27 Thread Cameron Simpson
On 27Aug2014 18:45, Crush wrote: Hello, it has been a while and I hope I am sending to the correct email. How would I go about running a conditional statement against the contents of stderr. For instance, if "blah blah blah" is in stderr do X, else do Y. #!/usr/bin/env python import sub

[Tutor] Interacting with stderr

2014-08-27 Thread Crush
Hello, it has been a while and I hope I am sending to the correct email. How would I go about running a conditional statement against the contents of stderr. For instance, if "blah blah blah" is in stderr do X, else do Y. CODE: SELECT ALL #!/usr/bin/env python import subprocess from subproce