urllib2.urlopen error "socket.error: [Errno 104] Connection reset by peer"

2015-05-04 Thread Jia CHEN
Hi There, I have the error below when trying to download the html content of a webpage. I can open this webpage in a browser without any problem. I am using Ubuntu 14.04. Could you give me come clues about what is happening and how to solve the issue? Thanks. $python Python 2.7.6 (default

Re: Bitten by my C/Java experience

2015-05-04 Thread Dave Angel
On 05/04/2015 04:28 PM, Cecil Westerhof wrote: Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly: On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence wrote: On 04/05/2015 16:20, Cecil Westerhof wrote: Potential dangerous bug introduced by programming in Python as if it was C/Java. :-( I used: ++

Re: Bitten by my C/Java experience

2015-05-04 Thread Tim Chase
On 2015-05-04 21:57, Andrew Cooper wrote: > On 04/05/2015 18:43, Ian Kelly wrote: > > > > Some other gotchas that aren't necessarily related to C/Java but > > can be surprising nonetheless: > > > > *() is a zero-element tuple, and (a, b) is a two-element > > tuple, but (a) is not a one-elemen

Re: Bitten by my C/Java experience

2015-05-04 Thread BartC
On 04/05/2015 16:20, Cecil Westerhof wrote: Potential dangerous bug introduced by programming in Python as if it was C/Java. :-( I used: ++tries that has to be: tries += 1 I think I've come across that. It doesn't mind ++ so people are likely to be assume that increment works as in o

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Irmen de Jong
On 4-5-2015 21:52, Cecil Westerhof wrote: > But I keep getting the error. Only 2 lines earlier: > >>> import urllib3.contrib.pyopenssl > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", > line 56,

Re: Bitten by my C/Java experience

2015-05-04 Thread random832
On Mon, May 4, 2015, at 16:57, Andrew Cooper wrote: > * {} is an empty set(), not dict(). You've got it backwards. > Particularly subtle when combined with **kwargs The function in your example below _always_ returns a set, and kwargs is always a dict. There's no subtlety outside of the repr out

Re: Bitten by my C/Java experience

2015-05-04 Thread Andrew Cooper
On 04/05/2015 18:43, Ian Kelly wrote: > > Some other gotchas that aren't necessarily related to C/Java but can > be surprising nonetheless: > > *() is a zero-element tuple, and (a, b) is a two-element tuple, > but (a) is not a one-element tuple. Tuples are created by commas, not > parentheses

Re: Why from en to two times with sending email

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 21:48 CEST schreef Ian Kelly: > On Mon, May 4, 2015 at 12:59 PM, Cecil Westerhof wrote: >> I want to change an old Bash script to Python. When I look at: >> https://docs.python.org/2/library/email-examples.html >> >> Then from and to have to be used two times? Why is that? >

Updating FaceBook

2015-05-04 Thread Cecil Westerhof
Using Python to update Twitter is reasonable straight forward. I do: from libturpial.api.coreimport Core from libturpial.exceptions import StatusDuplicated I fill an account_id and a message and I do: Core().update_status(account_id, message) And my message is posted. It looks l

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence
On 04/05/2015 09:58, Cecil Westerhof wrote: But when I do: import urllib3.contrib.pyopenssl I get: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 55, in import OpenSSL.SSL

Re: Bitten by my C/Java experience

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 21:39 CEST schreef Ian Kelly: > On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence > wrote: >> On 04/05/2015 16:20, Cecil Westerhof wrote: >>> >>> Potential dangerous bug introduced by programming in Python as if >>> it was C/Java. :-( I used: ++tries that has to be: tries += 1

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 21:02 CEST schreef Irmen de Jong: > On 4-5-2015 19:19, Cecil Westerhof wrote: > >> It looks like I am encircled by Gremlins: > import urllib3.contrib.pyopenssl >> Traceback (most recent call last): File "", line 1, in >> File >> "/usr/lib/python3.4/site-packages/urllib3/c

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 20:04 CEST schreef Mark Lawrence: > An alternative is to switch to Windows and do away with this archaic > concept of users having to build code :) Well, maybe I get rid of some problems. But the ones I get back … -- Cecil Westerhof Senior Software Engineer LinkedIn: http:/

Re: Bitten by my C/Java experience

2015-05-04 Thread Terry Reedy
On 5/4/2015 1:43 PM, Ian Kelly wrote: *() is a zero-element tuple, and (a, b) is a two-element tuple, but (a) is not a one-element tuple. Tuples are created by commas, not parentheses, so use (a,) instead. Which means that a, and a,b (or a,b,) are 1 and 2 element tuples respectively. Exce

Re: Why from en to two times with sending email

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 12:59 PM, Cecil Westerhof wrote: > I want to change an old Bash script to Python. When I look at: > https://docs.python.org/2/library/email-examples.html > > Then from and to have to be used two times? Why is that? Once to construct the message headers, and once to inst

Re: Bitten by my C/Java experience

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 11:59 AM, Mark Lawrence wrote: > On 04/05/2015 16:20, Cecil Westerhof wrote: >> >> Potential dangerous bug introduced by programming in Python as if it >> was C/Java. :-( >> I used: >> ++tries >> that has to be: >> tries += 1 >> >> Are there other things I have to

Why from en to two times with sending email

2015-05-04 Thread Cecil Westerhof
I want to change an old Bash script to Python. When I look at: https://docs.python.org/2/library/email-examples.html Then from and to have to be used two times? Why is that? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.pytho

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Irmen de Jong
On 4-5-2015 19:19, Cecil Westerhof wrote: > It looks like I am encircled by Gremlins: > >>> import urllib3.contrib.pyopenssl > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", > line 58, in >

ANN: Wing IDE 5.1.4 released

2015-05-04 Thread Wingware
Hi, Wingware has released version 5.1.4 of Wing IDE, our cross-platform integrated development environment for the Python programming language. Wing IDE features a professional code editor with vi, emacs, visual studio, and other key bindings, auto-completion, call tips, context-sensitive au

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence
On 04/05/2015 16:11, Cecil Westerhof wrote: Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico: On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof wrote: That gets installed. And then I get: ImportError: No module named 'cryptography' So I try to install that. This gives: Command /usr/bin/

Re: Bitten by my C/Java experience

2015-05-04 Thread Mark Lawrence
On 04/05/2015 16:20, Cecil Westerhof wrote: Potential dangerous bug introduced by programming in Python as if it was C/Java. :-( I used: ++tries that has to be: tries += 1 Are there other things I have to be careful on? That does not work as in C/Java, but is correct syntax. Not dan

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 3:19 AM, Cecil Westerhof wrote: > It looks like I am encircled by Gremlins: > >>> import urllib3.contrib.pyopenssl > Traceback (most recent call last): > File "", line 1, in > File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", > line

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 18:03 CEST schreef Chris Angelico: > On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof wrote: >> Now I get: c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids >> mixed declarations and code [-Werror=declaration-after-statement] >> PyObject *u = PyUnicode_DecodeLatin1(PyBytes_A

Re: Bitten by my C/Java experience

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 9:20 AM, Cecil Westerhof wrote: > Potential dangerous bug introduced by programming in Python as if it > was C/Java. :-( > I used: > ++tries > that has to be: > tries += 1 > > Are there other things I have to be careful on? That does not work as > in C/Java, but is c

Re: Bitten by my C/Java experience

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 3:32 AM, Irmen de Jong wrote: > That is a broad question, but one thing that comes to mind is the current > (python 3) > behavior of integer division. It gives the exact result and doesn't truncate > to integers: > > 5/4 > 1.25 Using the word "exact" around non-integ

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Terry Reedy
On 5/4/2015 9:35 AM, Davide Mancusi wrote: I believe this is a bug. I'm not sure it is, actually; imagine the text is coming in one character at a time (eg from a pipe), and it's seen "alpha\r". It knows that this is a line, so it emits it; but until the next character is read, it can't know wh

Re: Bitten by my C/Java experience

2015-05-04 Thread Irmen de Jong
On 4-5-2015 17:20, Cecil Westerhof wrote: > Potential dangerous bug introduced by programming in Python as if it > was C/Java. :-( > I used: > ++tries > that has to be: > tries += 1 > > Are there other things I have to be careful on? That does not work as > in C/Java, but is correct syntax

Re: Bitten by my C/Java experience

2015-05-04 Thread Tobiah
On 05/04/2015 08:20 AM, Cecil Westerhof wrote: Potential dangerous bug introduced by programming in Python as if it was C/Java. :-( I used: ++tries that has to be: tries += 1 Are there other things I have to be careful on? That does not work as in C/Java, but is correct syntax. One

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof wrote: > Now I get: > c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids mixed declarations > and code [-Werror=declaration-after-statement] > PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res), > ^ > cc1: some wa

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico: > On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof wrote: >> That gets installed. And then I get: >> ImportError: No module named 'cryptography' >> >> So I try to install that. This gives: Command /usr/bin/python3 -c >> "import setuptools, >

Bitten by my C/Java experience

2015-05-04 Thread Cecil Westerhof
Potential dangerous bug introduced by programming in Python as if it was C/Java. :-( I used: ++tries that has to be: tries += 1 Are there other things I have to be careful on? That does not work as in C/Java, but is correct syntax. -- Cecil Westerhof Senior Software Engineer LinkedIn: ht

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Ian Kelly
On Mon, May 4, 2015 at 9:17 AM, Peter Otten <__pete...@web.de> wrote: > OK, you convinced me. Then I tried: > with open("tmp.txt", "wb") as f: f.write("0\r\n3\r5\n7") > ... assert len(open("tmp.txt", "rb").read()) == 8 f = open("tmp.txt", "rU") f.readline() > '0\n' f.newlin

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 1:17 AM, Peter Otten <__pete...@web.de> wrote: > OK, you convinced me. Then I tried: > with open("tmp.txt", "wb") as f: f.write("0\r\n3\r5\n7") > ... assert len(open("tmp.txt", "rb").read()) == 8 f = open("tmp.txt", "rU") f.readline() > '0\n' f.newlin

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Peter Otten
Chris Angelico wrote: > On Mon, May 4, 2015 at 10:01 PM, Peter Otten <__pete...@web.de> wrote: >> I tried: >> > with open("tmp.txt", "wb") as f: f.write("alpha\r\nbeta\rgamma\n") >> ... > f = open("tmp.txt", "rU") > f.newlines > f.readline() >> 'alpha\n' > f.newlines >> # expec

Re: ImportPython Newsletter

2015-05-04 Thread Alex McFerron
I had the same problem just now Sent from my iPhone > On May 3, 2015, at 11:00 AM, Terry Reedy wrote: > >> On 5/3/2015 12:01 PM, Ankur Gupta wrote: >> Hey Guys, >> >> Just like to draw attention to ImportPython a weekly Python >> newsletter. This is the 30th issue of the newsletter >> http://i

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof wrote: > That gets installed. And then I get: > ImportError: No module named 'cryptography' > > So I try to install that. This gives: > Command /usr/bin/python3 -c "import setuptools, > tokenize;__file__='/tmp/pip_build_root/cryptography/se

Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 14:07 CEST schreef Chris Angelico: > On Mon, May 4, 2015 at 9:31 PM, Cecil Westerhof wrote: >> While copying pasting code to test, the following works: [chomp] >> But first I used: with NamedTemporaryFile(mode = 'w', prefix = file >> + '_', dir = filepath, delete = False) as

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 14:14 CEST schreef Chris Angelico: > On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof wrote: >>> Does 'pip3 install -U pyOpenSSL' work? >> Not really, because that gives: Requirement already up-to-date: >> pyOpenSSL in /usr/lib64/python3.4/site-packages Cleaning up... > > I do

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Davide Mancusi
>> I believe this is a bug. > > I'm not sure it is, actually; imagine the text is coming in one > character at a time (eg from a pipe), and it's seen "alpha\r". It > knows that this is a line, so it emits it; but until the next > character is read, it can't know whether it's going to be \r or \r\n.

http://premiumnaturalgarciniacambogiahelp.com/new-slim-5-garcinia-cambogia/

2015-05-04 Thread briansgoins via Python-list
New Slim 5 Garcinia Cambogia You can find plenty of Weight Loss tips one sees around in company, infomercials, TV and publications. The stark reality is that many of these tips actually work and a few really do not. To be honest with you, the fat diets, weight products and pills recommendations or

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof wrote: >> Does 'pip3 install -U pyOpenSSL' work? > Not really, because that gives: > Requirement already up-to-date: pyOpenSSL in > /usr/lib64/python3.4/site-packages > Cleaning up... I don't know why it wasn't automatically installed, but

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 10:01 PM, Peter Otten <__pete...@web.de> wrote: > I tried: > with open("tmp.txt", "wb") as f: f.write("alpha\r\nbeta\rgamma\n") > ... f = open("tmp.txt", "rU") f.newlines f.readline() > 'alpha\n' f.newlines > # expected: '\r\n' f.readline() > 'be

Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 9:31 PM, Cecil Westerhof wrote: > While copying pasting code to test, the following works: > [chomp] > But first I used: > with NamedTemporaryFile(mode = 'w', prefix = file + '_', dir = filepath, > delete = False) as tf: > tempfile = tf.name > with open(

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 12:10 CEST schreef Chris Angelico: > On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof wrote: >> When I then give: pip3 install -U OpenSSL It goes wrong: Could not >> fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client >> Error: Not Found >> >> I checked and even >> h

Re: when does newlines get set in universal newlines mode?

2015-05-04 Thread Peter Otten
are...@gmail.com wrote: > Hi all, > > I have a text file with Windows-style line terminators (\r\n) which I open > in universal newlines mode (Python 2.7). I would expect the newlines > attribute to be set after the first call to the readline() method, but > apparently this is not the case: > >>

Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
While copying pasting code to test, the following works: from itertools import islice from os import rename from os.pathimport expanduser, split from tempfile import NamedTemporaryFile real_file = (expanduser('~/Twitter/testing.txt')) (filepath, file)

Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof wrote: > When I then give: > pip3 install -U OpenSSL > It goes wrong: > Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client > Error: Not Found > > I checked and even > https://pypi.python.org/simple/ > does not exist.

when does newlines get set in universal newlines mode?

2015-05-04 Thread arekfu
Hi all, I have a text file with Windows-style line terminators (\r\n) which I open in universal newlines mode (Python 2.7). I would expect the newlines attribute to be set after the first call to the readline() method, but apparently this is not the case: >>> f=open('test_crlf', 'rU') >>> f.ne

Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
But when I do: import urllib3.contrib.pyopenssl I get: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 55, in import OpenSSL.SSL File "/usr/lib64/python3.4/site-packages/OpenSSL/__

EuroPython 2015: Vote for the talks you want to see

2015-05-04 Thread M.-A. Lemburg
Having received over 300 great proposals for talks, trainings, helpdesks and posters, we now call out to all attendees to vote for what you want to see on the conference schedule. You can search for topics and communicate your personal priorities by casting your vote for each submission on our tal