[Tutor] subprocess

2010-03-27 Thread kevin parks
I tried readings some toots and tried reading alan's thing. I just still can't grok how to use subprocess. I am trying to call sox (fun fact: an early contributer to sox was none other than Guido van Rossum) In the old days you would just use os i guess, like: import os os.system('sox -V3 -D -

Re: [Tutor] subprocess

2010-03-27 Thread David Abbott
On Sat, 2010-03-27 at 16:55 +0900, kevin parks wrote: > I tried readings some toots and tried reading alan's thing. I just still > can't grok how to use subprocess. > > I am trying to call sox (fun fact: an early contributer to sox was none other > than Guido van Rossum) > > In the old days you

Re: [Tutor] python magazine

2010-03-27 Thread Dave Angel
Lowell Tackett wrote: >From the virtual desk of Lowell Tackett --- On Fri, 3/26/10, Benno Lang wrote: From: Benno Lang Subject: Re: [Tutor] python magazine To: "Lowell Tackett" Cc: tutor@python.org, "Bala subramanian" Date: Friday, March 26, 2010, 8:38 PM On 27 March 2010 00:33, Lowel

Re: [Tutor] subprocess

2010-03-27 Thread kevin parks
Thanks David. Those are excellent short clear examples. I will look those over. Super! Thanks for that. -kp On Mar 27, 2010, at 5:30 PM, David Abbott wrote: > On Sat, 2010-03-27 at 16:55 +0900, kevin parks wrote: > > Here is an example using subprocess.call > http://dwabbott.com/code/index8.

Re: [Tutor] subprocess

2010-03-27 Thread Sander Sweers
On 27 March 2010 09:30, David Abbott wrote: > Here is an example using subprocess.call > http://dwabbott.com/code/index8.html > > and some more here with subprocess.Popen > http://asterisklinks.com/wiki/doku.php?id=wiki:subprocess On top of that we have the excelent PyMOTW from Doug on subprocess

[Tutor] "IOError: [Errno 32] Broken pipe" when running python with cron (alternatives?)

2010-03-27 Thread Karjer Jdfjdf
I have made an extensive script that runs fine when started from the command line or IDLE. When I try to run it with cron it keeps giving errors: Error in sys.exitfunc: Traceback (most recent call last):   File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs     func(*targs, **kargs)

[Tutor] Odds and even exercise

2010-03-27 Thread TJ Dack
Hi, just started python at Uni and think i am in for a rough ride with zero prior experience in programming. Anyway my problem that i can't fix my self after googling. The exercise is to generate a list of odd numbers between 1-100 and the same for even numbers. So far this is what i haveCODE: SE

Re: [Tutor] Odds and even exercise

2010-03-27 Thread Shashwat Anand
On Sat, Mar 27, 2010 at 6:25 PM, TJ Dack wrote: > Hi, just started python at Uni and think i am in for a rough ride with zero > prior experience in programming. > Anyway my problem that i can't fix my self after googling. > > The exercise is to generate a list of odd numbers between 1-100 and the

Re: [Tutor] Odds and even exercise

2010-03-27 Thread Steven D'Aprano
On Sat, 27 Mar 2010 11:55:01 pm TJ Dack wrote: > Hi, just started python at Uni and think i am in for a rough ride > with zero prior experience in programming. > Anyway my problem that i can't fix my self after googling. > > The exercise is to generate a list of odd numbers between 1-100 and > the

Re: [Tutor] Odds and even exercise

2010-03-27 Thread R. Alan Monroe
> odd = numbers[::2] > I can't find a way to easily list the even numbers, Hint: You can designate a start number before the first colon. Alan ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.or

Re: [Tutor] Odds and even exercise

2010-03-27 Thread Kelly Netterville
On Sat, Mar 27, 2010 at 8:55 AM, TJ Dack wrote: > Hi, just started python at Uni and think i am in for a rough ride with zero > prior experience in programming. > Anyway my problem that i can't fix my self after googling. > > The exercise is to generate a list of odd numbers between 1-100 and the

[Tutor] Introduction to modelling with Python

2010-03-27 Thread AG
Hi List I apologise in advance for the vagueness of this query, but I am looking for a decent modern introduction to modelling using Python. Specifically, I want something that is a good introduction (i.e. doesn't expect one to already be a maths/ statistics or a programming guru) and that h

[Tutor] Prime numbers

2010-03-27 Thread yd
Having a problem finding the first 1000 prime numbers, here is my code:- print(2) n =3 counter =1 while counter <=1000: for x in range(3,int((n**0.5)),2): if n%x != 0: print(n) n+=1 counter+=1 else: n+=1 The problem is, it prints 2 and then does nothing, yet if i

Re: [Tutor] Prime numbers

2010-03-27 Thread Shashwat Anand
>>> [x for x in range(3,int((n**0.5)),2)] [] your while loop is an infinite loop. Had you read the range documentations ? >>> range(3,int((n**0.5)),2) [] >>> n**0.5 1.7320508075688772 >>> n = 3 >>> n ** 0.5 1.7320508075688772 >>> int ( n ** 0.5) 1 >>> range ( 3, 1, 2) [] On Sun, Mar 28, 2010 at

Re: [Tutor] Odds and even exercise

2010-03-27 Thread yd
Hi, just started python at Uni and think i am in for a rough ride with zero > prior experience in programming. > Anyway my problem that i can't fix my self after googling. > > The exercise is to generate a list of odd numbers between 1-100 and the > same > for even numbers. > > So far this is what

Re: [Tutor] Odds and even exercise

2010-03-27 Thread Steven D'Aprano
On Sun, 28 Mar 2010 09:33:23 am yd wrote: > I find it easy to do all this stuff with list comprehensions, but > i am a beginner so this might not be the most efficient way to do it > > numbers=[] > for x in range(1,101): > numbers.append(x) That certainly isn't efficient! In Python 2.x, this