Re: Weighted choices

2013-09-07 Thread Peter Otten
Jason Friedman wrote: > choices = dict() > choices["apple"] = 10 > choices["pear"] = 20 > choices["banana"] = 15 > choices["orange"] = 25 > choices["kiwi"] = 30 > > I want to pick sets of fruit, three in a set, where the chance of > selecting a given fruit is proportional to its weight. In the e

Weighted choices

2013-09-07 Thread Jason Friedman
choices = dict() choices["apple"] = 10 choices["pear"] = 20 choices["banana"] = 15 choices["orange"] = 25 choices["kiwi"] = 30 I want to pick sets of fruit, three in a set, where the chance of selecting a given fruit is proportional to its weight. In the example above, pears should appear twice a

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread BlueFielder
Thanks guys … that too failed. It's late here and I'm bushed. I'll get back to this tomorrow morning. Much appreciated. It's probably important that I point out that I put the file ' fxp2aupreset.py ' in the root directory (ddd) . Just to keep things all together. Again …. I have NO idea how to

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread Chris Angelico
On Sun, Sep 8, 2013 at 1:34 PM, Michael Torrie wrote: > On 09/07/2013 09:09 PM, BlueFielder wrote: >> I 'think' I did as you instructed …. but that too failed. :( >> >> >> CiMac:ddd camforx$ find -type d -execdir bash -c 'cd {}; python >> ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata' \; >> find: i

Re: Can I trust downloading Python?

2013-09-07 Thread Dave Angel
On 7/9/2013 21:17, Aaron Martin wrote: > Hi, I am thinking about getting a software but it requires python, so that > brought up a few questions. Is it safe do download python, and does it come > with spam or advertisements? If it doesn't then should I get the latest > version? I mostly want to kn

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread Michael Torrie
On 09/07/2013 09:09 PM, BlueFielder wrote: > I 'think' I did as you instructed …. but that too failed. :( > > > CiMac:ddd camforx$ find -type d -execdir bash -c 'cd {}; python > ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata' \; > find: illegal option -- t > usage: find [-H | -L | -P] [-EXdsx] [-f

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread BlueFielder
I 'think' I did as you instructed …. but that too failed. :( CiMac:ddd camforx$ find -type d -execdir bash -c 'cd {}; python ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata' \; find: illegal option -- t usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression] find [-H | -L | -P] [

Re: Can I trust downloading Python?

2013-09-07 Thread Michael Torrie
On 09/07/2013 07:17 PM, Aaron Martin wrote: > Hi, I am thinking about getting a software but it requires python, so that > brought up a few questions. Is it safe do download python, and does it come > with spam or advertisements? If it doesn't then should I get the latest > version? I mostly want t

Re: Can I trust downloading Python?

2013-09-07 Thread Ben Finney
Aaron Martin writes: > Hi, I am thinking about getting a software but it requires python, so > that brought up a few questions. Is it safe do download python, and > does it come with spam or advertisements? Python is free software, meaning that every recipient is free to improve it and redistrib

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread Chris Angelico
On Sun, Sep 8, 2013 at 12:59 PM, BlueFielder wrote: > > Failed: > > Here is the command with the results: > > > CiMac:ddd camforx$ $ find -type d -execdir bash -c 'cd {}; python > ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata' \; > -bash: $: command not found Oh! Omit the dollar sign, tha

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread BlueFielder
Failed: Here is the command with the results: CiMac:ddd camforx$ $ find -type d -execdir bash -c 'cd {}; python ./fxp2aupreset.py ./ aumu Alb3 LinP vstdata' \; -bash: $: command not found -- With CiMac = HD ddd = folder on the desktop of user camforx -- https://mail.python.o

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread BlueFielder
On Saturday, September 7, 2013 9:56:25 PM UTC-4, Chris Angelico wrote: > Your initial command and path suggest you're on a Unix-like system > > (these days that most likely means either Linux or Mac OS), but the > > FOR command at the end is a Windows command, so that's not going to > > work. H

Re: Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread Chris Angelico
On Sun, Sep 8, 2013 at 11:41 AM, BlueFielder wrote: > 3. Then I run the script from terminal : python ./fxp2aupreset.py ./ aumu > Alb3 LinP vstdata > > It executes fine and does it's job. > > BUT… I have per 7600 files that are segregated into 86 folders. > I want to keep this folder structure. >

Help - Python syntax - repeats script through subordinate folders

2013-09-07 Thread BlueFielder
I'm NOT a programmer…. but I have a little Python script that converts files, that are in a folder, from one format to another. Script = fxp2aupreset.py I can successfully run it from the command line: 1st, I placed the folder that I named 'ddd' on the desktop so that it's easy to get to. 2

Re: Can I trust downloading Python?

2013-09-07 Thread Chris Angelico
On Sun, Sep 8, 2013 at 11:17 AM, Aaron Martin wrote: > Hi, I am thinking about getting a software but it requires python, so that > brought up a few questions. Is it safe do download python, and does it come > with spam or advertisements? If it doesn't then should I get the latest > version? I mos

Can I trust downloading Python?

2013-09-07 Thread Aaron Martin
Hi, I am thinking about getting a software but it requires python, so that brought up a few questions. Is it safe do download python, and does it come with spam or advertisements? If it doesn't then should I get the latest version? I mostly want to know if it is safe to download, because most of th

Re: file handling issues

2013-09-07 Thread Piet van Oostrum
Leo Carnovale writes: > Ah and one other thing! > What is this crypto algorithm you speak of? I desperately need some sort of > encryption as at the moment anyone can simply open the text file and change > the numbers to numbers that work! > Where can I learn more about it? You can google for

Re: PEP8 79 char max

2013-09-07 Thread Serhiy Storchaka
06.09.13 06:40, Steven D'Aprano написав(ла): PEP 8 certainly is a collection of rules. They are mandatory for new code added to the standard library, and optional but recommended for third party libraries. No. They are optional but recommended for new code added to the standard library, and in

Re: python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
On Saturday, September 7, 2013 9:47:47 AM UTC-6, Nobody wrote: > On Sat, 07 Sep 2013 03:55:02 -0700, larry.mart...@gmail.com wrote: > > > > > I have a python script and when I run it directly from the command line > > > it runs to completion. But I need to run it from another script. I do > >

Re: python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
On Saturday, September 7, 2013 5:19:25 AM UTC-6, Peter Otten wrote: > larry.mart...@gmail.com wrote: > > > > > I have a python script and when I run it directly from the command line it > > > runs to completion. But I need to run it from another script. I do that > > > like this: > > > > >

Re: python script hangs when run from subprocess

2013-09-07 Thread Nobody
On Sat, 07 Sep 2013 03:55:02 -0700, larry.mart...@gmail.com wrote: > I have a python script and when I run it directly from the command line > it runs to completion. But I need to run it from another script. I do > that like this: > > p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subp

Re: python script hangs when run from subprocess

2013-09-07 Thread Peter Otten
larry.mart...@gmail.com wrote: > I have a python script and when I run it directly from the command line it > runs to completion. But I need to run it from another script. I do that > like this: > > p = subprocess.Popen(cmd, stdout=subprocess.PIPE, > stderr=subprocess.STDOUT) rv = p.wait() > out_

python script hangs when run from subprocess

2013-09-07 Thread larry.mart...@gmail.com
I have a python script and when I run it directly from the command line it runs to completion. But I need to run it from another script. I do that like this: p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) rv = p.wait() out_buf = p.stdout.read() When I do this, wait n