Re: Using requests with an Authorization header?

2015-07-28 Thread dieter
devnzy...@use.startmail.com writes: > Has anyone ever used an authorization header with the requests library? I > tried using: > > from requests.auth import HTTPBasicAuth requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', 'pass') > > from their docs online but

Re: What happens when python seeks a text file

2015-07-28 Thread dieter
"=?GBK?B?wO68zsX0?=" writes: > Hi, I tried using seek to reverse a text file after reading about the > subject in the documentation: > > https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects > > https://docs.python.org/3/library/io.html#io.TextIOBase.seek > ... > However, an

Re: Gmail eats Python

2015-07-28 Thread Rustom Mody
A bizarre current gnus sob-story brought me back to this thread: http://lists.gnu.org/archive/html/help-gnu-emacs/2015-07/msg00738.html Starts here http://lists.gnu.org/archive/html/help-gnu-emacs/2015-07/msg00591.html On Sunday, July 26, 2015 at 4:13:17 PM UTC+5:30, Jussi Piitulainen wrote: > R

Re: Send data to asyncio coroutine

2015-07-28 Thread Rustom Mody
On Wednesday, July 29, 2015 at 4:37:22 AM UTC+5:30, Ian wrote: > I don't entirely disagree. I think that the implementation of async > coroutines on top of synchronous coroutines on top of generators is > overly clever and results in a somewhat leaky abstraction and a fair > amount of confusion. H

Re: Another tail recursion example

2015-07-28 Thread Terry Reedy
On 7/28/2015 5:28 PM, Paul Rubin wrote: Chris Angelico was asking for examples of tail recursion that didn't have obvious looping equivalents. Since there is a mechanical procedure for producing the equivalent *under the assumption that the function name will not be rebound*, he is effectivel

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Rustom Mody
On Wednesday, July 29, 2015 at 6:45:45 AM UTC+5:30, Chris Angelico wrote: > On Tue, Jul 28, 2015 at 11:55 PM, Victor Hooi wrote: > > I have a line that looks like this: > > > > 14 *0330 *0 760 411|0 0 770g 1544g 117g > > 1414 computedshopcartdb:103.5% 0

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Joel Goldstick
+1 Chris On Tue, Jul 28, 2015 at 8:08 PM, Chris Angelico wrote: > On Tue, Jul 28, 2015 at 11:55 PM, Victor Hooi wrote: >> I have a line that looks like this: >> >> 14 *0330 *0 760 411|0 0 770g 1544g 117g >> 1414 computedshopcartdb:103.5% 0 30|0

Re: ctypes for AIX

2015-07-28 Thread daixtr
I'm facing the same issue. No 'ctypes' in python 2.6/2.7 that i'm able to succesfully install via an AIX ppc rpm package. what's the story here? On Friday, 22 April 2011 22:30:07 UTC+8, Anssi Saari wrote: > "Waddle, Jim" writes: > > > I do not have sufficient knowledge to know how to fix thi

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Chris Angelico
On Tue, Jul 28, 2015 at 11:55 PM, Victor Hooi wrote: > I have a line that looks like this: > > 14 *0330 *0 760 411|0 0 770g 1544g 117g > 1414 computedshopcartdb:103.5% 0 30|0 0|119m97m > 1538 ComputedCartRS PRI 09:40:26 > > I'd lik

Re: Send data to asyncio coroutine

2015-07-28 Thread Ian Kelly
On Tue, Jul 28, 2015 at 2:41 PM, Javier wrote: > I think that force the developer to 'yield from' all function calls to keep > async capabilities is a big mistake, it should be more flexible, like this: > > import asyncio > > @asyncio.coroutine > fun non_blocking_io(): > """ Everybody knows I

Re: Send data to asyncio coroutine

2015-07-28 Thread Ian Kelly
On Tue, Jul 28, 2015 at 1:17 PM, Javier wrote: > Hello again. I have been investigating a bit your example. I don't understand > why I can't write something like this: > > > > import asyncio > > def foo(): > print("start foo") > try: > while True: > val = yiel

Re: Send data to asyncio coroutine

2015-07-28 Thread Javier
El martes, 28 de julio de 2015, 23:18:11 (UTC+2), Javier escribió: > El martes, 21 de julio de 2015, 15:42:47 (UTC+2), Ian escribió: > > On Tue, Jul 21, 2015 at 5:31 AM, wrote: > > > Hello, I'm trying to understand and link asyncio with ordinary > > > coroutines. Now I just want to understand

Re: Another tail recursion example

2015-07-28 Thread Ian Kelly
On Jul 28, 2015 1:36 PM, "Paul Rubin" wrote: > > Paul Rubin writes: > > Chris Angelico was asking for examples of tail recursion that didn't > > have obvious looping equivalents. Here's an Euler problem solution > > using memoization and (except that Python doesn't implement it) tail > > recursi

Re: Another tail recursion example

2015-07-28 Thread Paul Rubin
Paul Rubin writes: > Chris Angelico was asking for examples of tail recursion that didn't > have obvious looping equivalents. Here's an Euler problem solution > using memoization and (except that Python doesn't implement it) tail > recursion with an accumulator. Actually that's wrong, it's not r

Another tail recursion example

2015-07-28 Thread Paul Rubin
Chris Angelico was asking for examples of tail recursion that didn't have obvious looping equivalents. Here's an Euler problem solution using memoization and (except that Python doesn't implement it) tail recursion with an accumulator. # Solution to Euler problem 14, using memoization # h

Re: Send data to asyncio coroutine

2015-07-28 Thread Javier
El martes, 21 de julio de 2015, 15:42:47 (UTC+2), Ian escribió: > On Tue, Jul 21, 2015 at 5:31 AM, wrote: > > Hello, I'm trying to understand and link asyncio with ordinary coroutines. > > Now I just want to understand how to do this on asyncio: > > > > > > def foo(): > > data = yield 8 > >

Re: Concatenating columns via Python

2015-07-28 Thread MRAB
On 2015-07-28 19:50, hannahgracemcdonal...@gmail.com wrote: I extracted a table from a PDF so the data is quite messy and the data that should be in 1 row is in 3 colums, like so: year color location 1 1997 blue, MD 2green, 3

Concatenating columns via Python

2015-07-28 Thread hannahgracemcdonald16
I extracted a table from a PDF so the data is quite messy and the data that should be in 1 row is in 3 colums, like so: year color location 1 1997 blue, MD 2green, 3and yellow SO far my code is below, but I know I am

Re: Python Questions - July 25, 2015

2015-07-28 Thread Rob Gaddi
On Tue, 28 Jul 2015 17:45:00 +0100, BartC wrote: > On 28/07/2015 17:12, Steven D'Aprano wrote: >> On Tue, 28 Jul 2015 07:46 pm, BartC wrote: >> >>> (I'm still reeling from the size of that Anaconda download. Apparently >>> it contains a whole bunch of stuff, nothing to do with numpy, that I >>> do

Re: Python Questions - July 25, 2015

2015-07-28 Thread BartC
On 28/07/2015 17:12, Steven D'Aprano wrote: On Tue, 28 Jul 2015 07:46 pm, BartC wrote: (I'm still reeling from the size of that Anaconda download. Apparently it contains a whole bunch of stuff, nothing to do with numpy, that I don't need. But one of the listed packages was 'libffi', which is pu

Re: Python Questions - July 25, 2015

2015-07-28 Thread Steven D'Aprano
On Tue, 28 Jul 2015 07:46 pm, BartC wrote: > (I'm still reeling from the size of that Anaconda download. Apparently > it contains a whole bunch of stuff, nothing to do with numpy, that I > don't need. But one of the listed packages was 'libffi', which is > puzzling. This library lets a C-like lang

Re: Python Questions - July 25, 2015

2015-07-28 Thread Steven D'Aprano
On Tue, 28 Jul 2015 08:44 pm, BartC wrote: > No, I asked for how to install numpy, and was told to install Anaconda. > I didn't know it was so big. It's like asking where to buy a pint of > milk, and inadvertently buying the whole store! Which does, after all, > come with the milk I wanted... Bar

Re: Using requests with an Authorization header?

2015-07-28 Thread Chris Angelico
On Wed, Jul 29, 2015 at 1:34 AM, wrote: > but that's not working This is, I'm sorry to say, almost completely unhelpful - and also extremely common. Can you please post the full details of (a) what you did, (b) what happened or didn't happen, and (c) what you expect to happen? For example, are

Using requests with an Authorization header?

2015-07-28 Thread devnzyme1
Has anyone ever used an authorization header with the requests library? I tried using: >>> from requests.auth import HTTPBasicAuth >>> requests.get('https://api.github.com/user', auth=HTTPBasicAuth('user', >>> 'pass') from their docs online but that's not working and I don't see anything abou

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread MRAB
On 2015-07-28 15:09, Victor Hooi wrote: On Tuesday, 28 July 2015 23:59:11 UTC+10, m wrote: W dniu 28.07.2015 o 15:55, Victor Hooi pisze: > I know the regex library also has a split, unfortunately, that does not collapse consecutive whitespace: > > In [19]: re.split(' |', f) Try ' *\|' p. m.

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Oscar Benjamin
On Tue, 28 Jul 2015 at 15:01 Victor Hooi wrote: > I have a line that looks like this: > > 14 *0330 *0 760 411|0 0 770g 1544g 117g > 1414 computedshopcartdb:103.5% 0 30|0 0|119m97m > 1538 ComputedCartRS PRI 09:40:26 > > I'd like to spl

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Victor Hooi
On Tuesday, 28 July 2015 23:59:11 UTC+10, m wrote: > W dniu 28.07.2015 o 15:55, Victor Hooi pisze: > > I know the regex library also has a split, unfortunately, that does not > > collapse consecutive whitespace: > > > > In [19]: re.split(' |', f) > > Try ' *\|' > > p. m. Hmm, that seems to be

Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread Victor Hooi
I have a line that looks like this: 14 *0330 *0 760 411|0 0 770g 1544g 117g 1414 computedshopcartdb:103.5% 0 30|0 0|119m97m 1538 ComputedCartRS PRI 09:40:26 I'd like to split this line on multiple separators - in this case, consec

Re: Split on multiple delimiters, and also treat consecutive delimiters as a single delimiter?

2015-07-28 Thread m
W dniu 28.07.2015 o 15:55, Victor Hooi pisze: > I know the regex library also has a split, unfortunately, that does not > collapse consecutive whitespace: > > In [19]: re.split(' |', f) Try ' *\|' p. m. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Questions - July 25, 2015

2015-07-28 Thread Mark Lawrence
On 28/07/2015 09:50, Terry Reedy wrote: On 7/27/2015 7:14 PM, Rob Gaddi wrote: On Sun, 26 Jul 2015 13:49:57 +0100, BartC wrote: How do you actually install Numpy in Windows? I believe 'pip install numpy' works As I recall you noodle around with it for a few hours making things that look lik

Re: Python Questions - July 25, 2015

2015-07-28 Thread Mark Lawrence
On 28/07/2015 11:44, BartC wrote: Right you are. There is a pip.exe in the ./Scripts directory of Python 3.4. A handy tip for windows users is that there is a versioned number of pip, e.g. pip3.4.exe. Very useful indeed when you've multiple Python versions installed as I have, as it preven

Re: Python Questions - July 25, 2015

2015-07-28 Thread BartC
On 28/07/2015 11:17, Chris Angelico wrote: On Tue, Jul 28, 2015 at 7:46 PM, BartC wrote: On 28/07/2015 09:50, Terry Reedy wrote: I believe 'pip install numpy' works C:>pip install numpy 'pip' is not recognized as an internal or external command, operable program or batch file. Then g

Re: Python Questions - July 25, 2015

2015-07-28 Thread Chris Angelico
On Tue, Jul 28, 2015 at 7:46 PM, BartC wrote: > On 28/07/2015 09:50, Terry Reedy wrote: >> I believe 'pip install numpy' works > > > C:>pip install numpy > > 'pip' is not recognized as an internal or external command, > operable program or batch file. Then go and update your Python, because the

Re: Python Questions - July 25, 2015

2015-07-28 Thread BartC
On 28/07/2015 09:50, Terry Reedy wrote: On 7/27/2015 7:14 PM, Rob Gaddi wrote: On Sun, 26 Jul 2015 13:49:57 +0100, BartC wrote: How do you actually install Numpy in Windows? I believe 'pip install numpy' works C:>pip install numpy 'pip' is not recognized as an internal or external command

Re: Python Questions - July 25, 2015

2015-07-28 Thread Terry Reedy
On 7/27/2015 7:14 PM, Rob Gaddi wrote: On Sun, 26 Jul 2015 13:49:57 +0100, BartC wrote: How do you actually install Numpy in Windows? I believe 'pip install numpy' works As I recall you noodle around with it for a few hours making things that look like progress but turn out to be rabbit hole

Re: Authenticate users using command line tool against AD in python

2015-07-28 Thread Michael Ströder
Prasad Katti wrote: > I am writing a command line tool in python to generate one time > passwords/tokens. The command line tool will have certain sub-commands like > --generate-token and --list-all-tokens for example. I want to restrict > access to certain sub-commands. In this case, when user trie

What happens when python seeks a text file

2015-07-28 Thread 李嘉鹏
Hi, I tried using seek to reverse a text file after reading about the subject in the documentation: https://docs.python.org/3/tutorial/inputoutput.html#methods-of-file-objects https://docs.python.org/3/library/io.html#io.TextIOBase.seek The script "reverse_text_by_seek3.py" produces expected res

Usage of P(C)ython Logo for Coffee Mug

2015-07-28 Thread deus ex
Dear sirs or madam, I would like to let produce a p(c)ython coffee mug for myself for non-commerical use. Am I allowed to use your designed logo like: https://www.python.org/static/community_logos/python-logo-generic.svg https://upload.wikimedia.org/wikipedia/de/thumb/c/ce/Cython-logo.svg/640px-C