Re: Python gotcha of the day

2018-03-14 Thread Ben Finney
Steven D'Aprano writes: > py> """\"" > '"' That's an empty string delimited by ‘"’; followed by a double-quote character, escaped, delimited by ‘"’; followed by two more empty strings. They concatenate to a single one-character string. Equivalent to "" + "\"" + "" + "" without the ‘+’

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Chris Angelico
On Thu, Mar 15, 2018 at 3:54 PM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> That means going back to the original problem: "how do we get a usable >> stock price API?". > > > Does it have to be stock prices in particular? > Or just some simple piece of data that demonstrates > the principl

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Gregory Ewing
Chris Angelico wrote: That means going back to the original problem: "how do we get a usable stock price API?". Does it have to be stock prices in particular? Or just some simple piece of data that demonstrates the principles of fetching a url and parsing the result? -- Greg -- https://mail.py

Re: Enumerating all 3-tuples (Posting On Python-List Prohibited)

2018-03-14 Thread Ben Bacarisse
Lawrence D’Oliveiro writes: > On Wednesday, March 14, 2018 at 2:18:24 PM UTC+13, Ben Bacarisse wrote: >> Lawrence D’Oliveiro writes: >> >> The original problem -- triples of natural numbers -- is >> not particularly hard, but the general problem -- enumerating n-tuples >> of some sequence -- is

Re: Restore via pip to new OS

2018-03-14 Thread Tim Johnson
* Paul Moore [180314 15:42]: > Use pip freeze rather than pip list. That will give you the > information in "requirements file" format that pip install -r can > read. > > On 14 March 2018 at 23:20, Tim Johnson wrote: <...> > > Can I duplicate the same packages on the new OS by > > pip -r piplis

Re: Restore via pip to new OS

2018-03-14 Thread Paul Moore
Use pip freeze rather than pip list. That will give you the information in "requirements file" format that pip install -r can read. Paul On 14 March 2018 at 23:20, Tim Johnson wrote: > I'm currently running both python and python3 on ubuntu 14.04. > Plan is to do a complete re-install of ubuntu

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Chris Angelico
On Thu, Mar 15, 2018 at 10:27 AM, Gregory Ewing wrote: > Chris Angelico wrote: >> >> (Basically, >> what you're doing is downgrading the protection of HTTPS to something >> nearer plain HTTP. That's fine for what you're doing, but any code you >> give to students is likely to be copied and pasted

Re: urllib.request.urlopen fails with https

2018-03-14 Thread Gregory Ewing
Chris Angelico wrote: (Basically, what you're doing is downgrading the protection of HTTPS to something nearer plain HTTP. That's fine for what you're doing, but any code you give to students is likely to be copied and pasted into their production code.) See if you can tie in with your OS's cert

Restore via pip to new OS

2018-03-14 Thread Tim Johnson
I'm currently running both python and python3 on ubuntu 14.04. Plan is to do a complete re-install of ubuntu 16.04 on a fresh hard drive. I've accumulated a list of pip-install packages via pip list > piplist.txt. Can I duplicate the same packages on the new OS by pip -r piplist.txt? thanks --

Re: urllib.request.urlopen fails with https (was: Re: Stock quote APi)

2018-03-14 Thread Chris Angelico
On Thu, Mar 15, 2018 at 9:04 AM, Irv Kalb wrote: > ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed > (_ssl.c:749) > > Am I doing something wrong? Is there another way (besides using the requests > module which DOES work for me) to get data from an https URL? So my

urllib.request.urlopen fails with https (was: Re: Stock quote APi)

2018-03-14 Thread Irv Kalb
Thanks to Chris A and Roger C for their information. Very helpful and I am working on both of their suggestions. But now I've run into a new related problem. I still am trying to get stock information using Standard Library calls for now (although I understand that the requests module makes t

Re: macOS specific - reading calendar information

2018-03-14 Thread Larry Martell
On Wed, Mar 14, 2018 at 4:31 PM, Jan Erik Moström wrote: > I've been trying to find some example of how to read calendar info on macOS > but I haven't found anything ... I'm probably just bad at searching !! > > What I want to do is to read calendar info for a date range. Does anyone > know of an

macOS specific - reading calendar information

2018-03-14 Thread Jan Erik Moström
I've been trying to find some example of how to read calendar info on macOS but I haven't found anything ... I'm probably just bad at searching !! What I want to do is to read calendar info for a date range. Does anyone know of an example of how to do this? = jem -- https://mail.python.org/m

Re: TLSServer: certificate one request behind...

2018-03-14 Thread Fabiano Sidler
Thus wrote Fabiano Sidler: > What's the reason for this? Please find attached my TLSServer. Oh, sorry...! Apparently, the attachment has been stripped. Here inline: === tlsserver.py === from socketserver import ThreadingTCPServer,StreamRequestHandler import ssl class TLSServer(ThreadingTCPServer

Re: matplotlib icon

2018-03-14 Thread Terry Reedy
On 3/14/2018 2:30 PM, tedo.vrba...@gmail.com wrote: I am getting this logging.INFO notice: Could not load matplotlib icon: bad option "foobar": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmas

matplotlib icon

2018-03-14 Thread tedo . vrbanec
I am getting this logging.INFO notice: Could not load matplotlib icon: bad option "foobar": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, man

Re: Python gotcha of the day

2018-03-14 Thread Brian Oney via Python-list
explicit is better than implicit. That gives me an idea for a module with the following debugging command line functionality. import sass >>> "" ":p" Traceback: Are you telling me that ' ' is supposed to an operator? (Rock thrown) On March 14, 2018 10:40:38 AM GMT+01:00, Thomas Jollans wr

TLSServer: certificate one request behind...

2018-03-14 Thread Fabiano Sidler
Hi folks! I have written a TLSServer for testing purposes that generates self-signed certificates upon request. This works pretty well except that the certificates are always supplied one request too late: # gets no cert, but a handshake failure instead $ openssl s_client -connect localhost:1234

Re: 2.7 EOL = 2020 January 1

2018-03-14 Thread Mark Lawrence
On 13/03/18 18:30, Tim Chase wrote: On 2018-03-13 10:58, Terry Reedy wrote: Two days later, Benjamin Peterson, the 2.7 release manager, replied "Sounds good to me. I've updated the PEP to say 2.7 is completely dead on Jan 1 2020." adding "The final release may not literally be on January 1st".

Re: Enumerating all 3-tuples

2018-03-14 Thread Denis Kasak
On 2018-03-10 02:13, Steven D'Aprano wrote: But I've stared at this for an hour and I can't see how to extend the result to three coordinates. I can lay out a grid in the order I want: 1,1,1 1,1,2 1,1,3 1,1,4 ... 2,1,1 2,1,2 2,1,3 2,1,4 ... 1,2,1 1,2,2 1,2,3 1,2,4 ... 3,

Re: Python gotcha of the day

2018-03-14 Thread Thomas Jollans
On 2018-03-14 05:08, Steven D'Aprano wrote: > Explain the difference between these two triple-quoted strings: > > Here is a triple-quoted string containing spaces and a triple-quote: > > py> """ \""" """ > ' """ ' > > > But remove the spaces, and two of the quotation marks disappear: > > py> "