Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Steven D'Aprano
On Wednesday 06 January 2016 07:25, Robert wrote: > Why is there difference between cmd line and .py file? Almost certainly because you are not running exactly the same code each time. > I run below code, which is downloaded from link: Your code fails on the first line with NameError: n

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Steven D'Aprano
On Wednesday 06 January 2016 07:37, John Gordon wrote: > The built-in function sum() returns a single value, not a list, so this > is a reasonable error. Not quite. It depends on what arguments you give it. py> a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] py> sum(a, []) [1, 2, 3, 4, 5, 6, 7, 8, 9] Bu

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Steven D'Aprano
On Wednesday 06 January 2016 10:25, Thomas 'PointedEars' Lahn wrote: > Robert wrote: > >> I just wonder that the cmd line function sum may be different from the >> .py file used. One is numpy package, the other is a general one. Then, >> how can I further make it clear for this guess? > > Among

Python launcher options

2016-01-05 Thread Edward Diener
The Python launcher in Windows is a neat tool for running multiple versions of Python 2 and Python 3 at different times. It allows as options the ability to specify the latest version of either Python 2 or Python 3 defaulting to the 64-bit version if both exist, or a specific 32-bit or 64-bit v

Re: create Email with multiple HTML blocks embedded

2016-01-05 Thread Thomas 'PointedEars' Lahn
kevind0...@gmail.com wrote: Please either do not use Google Groups and configure your newsreader accordingly (recommended), or use Google Groups to subscribe to the newsgroup so that you can specify your real name. > body = MIMEMultipart('multipart') Obviously there is redu

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Thomas 'PointedEars' Lahn
Robert wrote: > I just wonder that the cmd line function sum may be different from the > .py file used. One is numpy package, the other is a general one. Then, > how can I further make it clear for this guess? Among other things: print(sum.__doc__) -- PointedEars Twitter: @PointedEars2 Please

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Thomas 'PointedEars' Lahn
Joel Goldstick wrote: > On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote: >> import numpy as np >> >> In [154]: np.sum(expectation_A)[0] >> […] >> IndexError: invalid index to scalar variable. > > I've not used numpy, but you should print expectation_A to see what's in > it. It may be empty, causin

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Robert
On Tuesday, January 5, 2016 at 3:58:44 PM UTC-5, Joel Goldstick wrote: > On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote: > > > On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote: > > > In Robert < > > r...@gmail.com> writes: > > > > > > > > > > > # represent the experi

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Joel Goldstick
On Tue, Jan 5, 2016 at 3:45 PM, Robert wrote: > On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote: > > In Robert < > r...@gmail.com> writes: > > > > > > > > # represent the experiments > > > head_counts = np.array([5,9,8,4,7]) > > > > The code doesn't define 'np', s

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Robert
On Tuesday, January 5, 2016 at 3:37:53 PM UTC-5, John Gordon wrote: > In Robert > writes: > > > > > # represent the experiments > > head_counts = np.array([5,9,8,4,7]) > > The code doesn't define 'np', so this line should produce an error. > > The code you linked contains this im

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread Robert
On Tuesday, January 5, 2016 at 3:26:15 PM UTC-5, Robert wrote: > Hi, > > I run below code, which is downloaded from link: > > http://stackoverflow.com/questions/15513792/expectation-maximization-coin-toss-examples?rq=1 > > > > > # represent the experiments > head_counts = np.array

Re: Why is there difference between cmd line and .py file?

2016-01-05 Thread John Gordon
In Robert writes: > > # represent the experiments > head_counts = np.array([5,9,8,4,7]) The code doesn't define 'np', so this line should produce an error. The code you linked contains this import: import numpy as np However you didn't show it here, so I wonder if you poste

Why is there difference between cmd line and .py file?

2016-01-05 Thread Robert
Hi, I run below code, which is downloaded from link: http://stackoverflow.com/questions/15513792/expectation-maximization-coin-toss-examples?rq=1 # represent the experiments head_counts = np.array([5,9,8,4,7]) tail_counts = 10-head_counts experiments = zip(head_counts,tail_counts)

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Ian Kelly
On Tue, Jan 5, 2016 at 10:02 AM, Paul Rubin wrote: > Steven D'Aprano writes: >> Maybe they're stress-testing a web server, or they just want to download >> things in a rush. > > They're stress-testing a web server through a tor proxy? This sounds > abusive to me. > > I also wonder whether 400 re

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Paul Rubin
Steven D'Aprano writes: > Maybe they're stress-testing a web server, or they just want to download > things in a rush. They're stress-testing a web server through a tor proxy? This sounds abusive to me. I also wonder whether 400 referred to the HTTP 400 error code rather than the number of requ

create Email with multiple HTML blocks embedded

2016-01-05 Thread kevind0718
The below script will send an email with one HTML file embedded and the second attached. Not really what I need. I need a Python script to create an email that contains multiple blocks of HTML in the body of the email. There is a process that will create at least one HTML file but very often t

Re: Is there a way importing a string object?

2016-01-05 Thread Robin Koch
Am 05.01.2016 um 03:24 schrieb jf...@ms4.hinet.net: (Please make the body of your message complete. The "Subject" field should be a summary of your message's subject, and may not be read as the first line of your message.) Yes, The "Subject" seems a little strange, read likes a part of the bod

Re: Is '*args' useful in this example code?

2016-01-05 Thread Robert
On Monday, January 4, 2016 at 10:28:31 PM UTC-5, Ben Finney wrote: > Robert <.com> writes: > > > On Monday, January 4, 2016 at 9:26:47 PM UTC-5, Ben Finney wrote: > > > Can you show example code that you would expect, and specifically what > > > about > > > the actual code doesn't match what you

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Tim Chase
On 2016-01-05 20:38, Steven D'Aprano wrote: > On Tue, 5 Jan 2016 07:53 pm, Tony van der Hoff wrote: > > > Why would someone want to make 400 HTTP requests in a short time? > > For the same reason they want to make 400 HTTP requests over a long > time, except that they're in a hurry. > > Maybe th

Re: Is '*args' useful in this example code?

2016-01-05 Thread Antoon Pardon
Op 05-01-16 om 03:16 schreef Robert: > Hi, > > I find an example code on wrap at this link: > http://stackoverflow.com/questions/308999/what-does-functools-wraps-do > > Here is the code: > > def logged(func): > def with_logging(*args, **kwargs): > print func.__name__ + " was ca

Re: subprocess check_output

2016-01-05 Thread Chris Angelico
On Tue, Jan 5, 2016 at 10:15 PM, me wrote: > On 2016-01-02, Chris Angelico wrote: >> down to "whoops, I forgot to save the file" or "whoops, I was in the >> wrong directory"... > > Amen, bro. > > Exceptionally true if you ever need for some reason to put your code in > another directory, but you

Re: subprocess check_output

2016-01-05 Thread me
On 2016-01-02, Chris Angelico wrote: > down to "whoops, I forgot to save the file" or "whoops, I was in the > wrong directory"... Amen, bro. Exceptionally true if you ever need for some reason to put your code in another directory, but you forget to close the files in your editor. :D -- https:/

PLease have problem in operate python 27 with pycharm environment,

2016-01-05 Thread hanaamohsin77
I need help in install packages like scipy by pip and conda on the in the pycharm environment -- https://mail.python.org/mailman/listinfo/python-list

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Steven D'Aprano
On Tue, 5 Jan 2016 07:53 pm, Tony van der Hoff wrote: > Why would someone want to make 400 HTTP requests in a short time? For the same reason they want to make 400 HTTP requests over a long time, except that they're in a hurry. Maybe they're stress-testing a web server, or they just want to down

Re: What is the fastest way to do 400 HTTP requests using requests library?

2016-01-05 Thread Tony van der Hoff
On 05/01/16 00:51, Ian Kelly wrote: > On Mon, Jan 4, 2016 at 4:38 PM, Steven D'Aprano wrote: >> On Tue, 5 Jan 2016 07:50 am, livems...@gmail.com wrote: >> >>> So what is the fastest way to make 400 HTTP requests using "requests" >>> library and also using tor proxy? >> >> >> Since this will be I/O