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] debug and execute python code in Mac

2014-08-27 Thread Sebastian Silva
I stumbled today upon this IDE for the mac http://plotdevice.io/ From the looks of it, it seems like a nice tool for teaching/learning Python. Too bad it's mac only. If you try it, do share your experience. I don't use non-free operating systems, so I can't try it myself. Regards, Sebastian

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

Re: [Tutor] Python Programming

2014-08-27 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
change the line if answera == ["Oslo" or "oslo"]: to if answera == "Oslo" or answera == "oslo": and see if it works. regards, Sarma. On Thu, Aug 28, 2014 at 12:27 AM, Alan Gauld wrote: > On 27/08/14 14:40, Jake wrote: > >> To whom it may concern, >> My name is Jake and I have recently sta

[Tutor] Interacting with stderr

2014-08-27 Thread Crush
gt; from subprocess import PIPE > i = 0 > while i < 10: >p = subprocess.call("avconv -v verbose -re -analyzeduration 1000 -i > http://localhost:6498/ms2/1382097438004/0MediaPlayer+0+/octoshape+hVV+octolive.americaone.com+V+aone+V+live+V+ONECONNXT_DEMO1_HD_flv/aonelive

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] debug and execute python code in Mac

2014-08-27 Thread Alan Gauld
On 27/08/14 13:47, Patrick Thunstrom wrote: I do not like the cmd/terminal execution. Thanks ! I don't know many ways to debug code that don't involve the terminal in some fashion. Even with a good IDE you're going to have a terminal built in for output. Not necessarily. A text display widge

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

Re: [Tutor] simple unicode question

2014-08-27 Thread Alan Gauld
On 27/08/14 15:57, Albert-Jan Roskam wrote: if *fewer* than 1 in 10 operations will raise an exception, then use try...except; but if *more* than 1 in 10 operations will raise an exception, and it is safe to do so, then LBYL may be appropriate. Thanks a lot, Steven! This kind of stuff should

Re: [Tutor] Python Programming

2014-08-27 Thread Alan Gauld
On 27/08/14 14:40, Jake wrote: To whom it may concern, My name is Jake and I have recently started the GCSE computing course with school. answera = input() if answera == ["Oslo" or "oslo"]: This doesn't do what you think it does. ["Oslo" or "oslo"] is a list "Oslo" or "oslo" is the con

Re: [Tutor] datetime substraction

2014-08-27 Thread Anirudh Tamsekar
Hi Alan/Danny/Steve, Thank you very much, I'm able to get the script working. -Regards, Anirudh Tamsekar On Tue, Aug 26, 2014 at 10:25 PM, Alan Gauld wrote: > On 26/08/14 10:10, Anirudh Tamsekar wrote: > > *Traceback (most recent call last):* >> * File "./rsyslog_check.py", line 22, in * >

Re: [Tutor] debug and execute python code in Mac

2014-08-27 Thread Patrick Thunstrom
On Wed, Aug 27, 2014 at 7:14 AM, Najam Qasim wrote: > What is preferable method to debug and execute python code in Mac? > > I do not like the cmd/terminal execution. Thanks ! > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change sub

[Tutor] Python Programming

2014-08-27 Thread Jake
To whom it may concern, My name is Jake and I have recently started the GCSE computing course with school. As summer holidays homework we have been asked to make a game. So I have made a Capital Cities Quiz. When I run my program this part of my coding does not seem to work: answera = input() if

Re: [Tutor] simple unicode question

2014-08-27 Thread Albert-Jan Roskam
- Original Message - > From: Steven D'Aprano > To: tutor@python.org > Cc: > Sent: Tuesday, August 26, 2014 2:08 PM > Subject: Re: [Tutor] simple unicode question > > On Tue, Aug 26, 2014 at 03:58:17AM -0700, Albert-Jan Roskam wrote: > >> Interesting, you follow a "look before you leap"

Re: [Tutor] debug and execute python code in Mac

2014-08-27 Thread Najam Qasim
> What is preferable method to debug and execute python code in Mac? > I do not like the cmd/terminal execution. Thanks ! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tutor Digest, Vol 126, Issue 64

2014-08-27 Thread Alan Gauld
On 27/08/14 02:41, Najam Qasim wrote: What is preferable method to debug and execute python code in Mac? I do not like the cmd/terminal execution. That is a very personal choice. You don't tell us what you don't like about the terminal or what features you consider important in your choice of t

Re: [Tutor] Tutor Digest, Vol 126, Issue 64

2014-08-27 Thread Najam Qasim
What is preferable method to debug and execute python code in Mac? I do not like the cmd/terminal execution. Thank you. > On Aug 26, 2014, at 6:00 AM, tutor-requ...@python.org wrote: > > Send Tutor mailing list submissions to >tutor@python.org > > To subscribe or unsubscribe via the World W