[issue37014] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-06-02 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the report and the PRs! -- resolution: -> fixed stage: patch review -> resolved status: open -> closed title: [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin -&g

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-06-02 Thread Ezio Melotti
Ezio Melotti added the comment: New changeset 6bd438e137a0618b8db949a4751304f541b6674d by Ezio Melotti (Miss Islington (bot)) in branch '3.7': bpo-37014: Update docstring and Documentation of fileinput.FileInput(). (GH-13545) (GH-13753)

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-06-02 Thread Ezio Melotti
Ezio Melotti added the comment: New changeset aca273e2401ca3151e15e984f400233b7f255e15 by Ezio Melotti (Michele Angrisano) in branch 'master': bpo-37014: Update docstring and Documentation of fileinput.FileInput(). (GH-13545)

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-06-02 Thread miss-islington
Change by miss-islington : -- pull_requests: +13634 pull_request: https://github.com/python/cpython/pull/13753 ___ Python tracker ___

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-24 Thread Michele Angrisano
Michele Angrisano added the comment: I've just made a PR for this issue. -- ___ Python tracker ___ ___ Python-bugs-list mailing

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-24 Thread Michele Angrisano
Change by Michele Angrisano : -- keywords: +patch pull_requests: +13457 stage: -> patch review ___ Python tracker ___ ___

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-24 Thread Michele Angrisano
Michele Angrisano added the comment: The Python's version chosen for this issue is 3.7. I think the suggest can be useful for 3.8 as well. Am I right? -- nosy: +mangrisano ___ Python tracker

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-23 Thread Grant Wu
Change by Grant Wu : -- nosy: +grantwu -Grant Wu2 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-23 Thread Stéphane Wirtel
Change by Stéphane Wirtel : -- keywords: +easy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37014] [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-23 Thread Stéphane Wirtel
that openhook and mode are ignored when reading from stdin -> [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin ___ Python tracker <https://bugs.python.org/issu

[issue37014] fileinput module should document that openhook and mode are ignored when reading from stdin

2019-05-22 Thread Grant Wu
New submission from Grant Wu : https://github.com/python/cpython/blob/master/Lib/fileinput.py#L326 shows that the openhook and mode are ignored when reading from stdin. Since part of fileinput's functionality is to abstract over whether one is reading from stdin or over a file, I think

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Mark Lawrence
On 24/10/2013 04:53, Ben Finney wrote: Tim Daneliuk tun...@tundraware.com writes: 'Easy there Rainman I'll thank you not to use mental deficiency as some kind of insult. Calling someone “Rainman” is to use autistic people as the punchline of a joke. We're a community that doesn't welcome

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Ben Finney
Mark Lawrence breamore...@yahoo.co.uk writes: On 24/10/2013 04:53, Ben Finney wrote: Tim Daneliuk tun...@tundraware.com writes: 'Easy there Rainman I'll thank you not to use mental deficiency as some kind of insult. Calling someone “Rainman” is to use autistic people as the punchline

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Tim Chase
On 2013-10-24 14:53, Ben Finney wrote: I think the request is incoherent: If you want to allow the user to primarily interact with the program, this is incompatible with also wanting to redirect standard input. As a counter-example, might I suggest one I use regularly:

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 01:09, Tim Daneliuk tun...@tundraware.com wrote: Now that I think about it, as I recall from the prehistoric era of writing lots of assembler and C, if you use shell redirection, stdin shows up as a handle to the file Yes this is true. A demonstration using seek (on Windows

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Tim Daneliuk
On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome ableist (nor sexist) behaviour. Well now I just feel so very awful ... -- Tim Daneliuk tun...@tundraware.com PGP Key:

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Oscar Benjamin
On 24 October 2013 12:58, Tim Daneliuk tun...@tundraware.com wrote: On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome ableist (nor sexist) behaviour. Well now I just feel so very awful ... Please end this line of discussion. Ben is right: your comment was entirely unnecessary and

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Tim Daneliuk
On 10/24/2013 07:10 AM, Oscar Benjamin wrote: On 24 October 2013 12:58, Tim Daneliuk tun...@tundraware.com wrote: On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome ableist (nor sexist) behaviour. Well now I just feel so very awful ... Please end this line of discussion. Ben is

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread feedthetroll
Am Donnerstag, 24. Oktober 2013 15:41:52 UTC+2 schrieb Tim Daneliuk: On 10/24/2013 07:10 AM, Oscar Benjamin wrote: On 24 October 2013 12:58, Tim Daneliuk tun...@tundraware.com wrote: On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome ableist (nor sexist) behaviour. Well now I just

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Ethan Furman
On 10/24/2013 06:41 AM, Tim Daneliuk wrote: But now I feel bad about myself and it's all your fault. Really? *plonk* -- https://mail.python.org/mailman/listinfo/python-list

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Tim Daneliuk
On 10/24/2013 09:36 AM, feedthetr...@gmx.de wrote: Am Donnerstag, 24. Oktober 2013 15:41:52 UTC+2 schrieb Tim Daneliuk: On 10/24/2013 07:10 AM, Oscar Benjamin wrote: On 24 October 2013 12:58, Tim Daneliuk tun...@tundraware.com wrote: On 10/23/2013 11:54 PM, Ben Finney wrote: we don't welcome

Re: Reading From stdin After Command Line Redirection

2013-10-24 Thread Ethan Furman
On 10/24/2013 01:14 AM, Mark Lawrence wrote: On 24/10/2013 04:53, Ben Finney wrote: Tim Daneliuk tun...@tundraware.com writes: 'Easy there Rainman I'll thank you not to use mental deficiency as some kind of insult. Calling someone “Rainman” is to use autistic people as the punchline of a

Reading From stdin After Command Line Redirection

2013-10-23 Thread Tim Daneliuk
I have a program that runs like this: foo.py inputfile I want to reconnect stdin to the tty as usual after 'inputfile' has been read so that things like raw_input and getpass will work as expected. So, after I do = sys.stdin.readlines(), how to I reopen stdin in its nonredirected mode?

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Chris Angelico
On Thu, Oct 24, 2013 at 4:25 AM, Tim Daneliuk tun...@tundraware.com wrote: I have a program that runs like this: foo.py inputfile I want to reconnect stdin to the tty as usual after 'inputfile' has been read so that things like raw_input and getpass will work as expected. So, after I do

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Ben Finney
Tim Daneliuk tun...@tundraware.com writes: I have a program that runs like this: foo.py inputfile That's one way to run it. If the user chooses to run it that way, they have chosen deliberately to run the program non-interactively. I want to reconnect stdin to the tty as usual after

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Chris Angelico
On Thu, Oct 24, 2013 at 7:46 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Can you speak more about how you intend your program to be used? The above request is incoherent, and I suspect you've made a design mistake. There are times when this is correct behaviour - like asking for passwords

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread random832
On Wed, Oct 23, 2013, at 16:52, Chris Angelico wrote: There are times when this is correct behaviour - like asking for passwords (SSH and sudo work like this). Less (or pagers generally, or an interactive text editor that allows creating a file from standard input) would be another example of a

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Ben Finney
random...@fastmail.us writes: On Wed, Oct 23, 2013, at 16:52, Chris Angelico wrote: There are times when this is correct behaviour - like asking for passwords (SSH and sudo work like this). Less (or pagers generally, or an interactive text editor that allows creating a file from standard

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Chris Angelico
On Thu, Oct 24, 2013 at 9:20 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: random...@fastmail.us writes: On Wed, Oct 23, 2013, at 16:52, Chris Angelico wrote: There are times when this is correct behaviour - like asking for passwords (SSH and sudo work like this). Less (or pagers

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Tim Daneliuk
On 10/23/2013 05:20 PM, Ben Finney wrote: random...@fastmail.us writes: On Wed, Oct 23, 2013, at 16:52, Chris Angelico wrote: There are times when this is correct behaviour - like asking for passwords (SSH and sudo work like this). Less (or pagers generally, or an interactive text editor

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Ben Finney
Tim Daneliuk tun...@tundraware.com writes: 'Easy there Rainman I'll thank you not to use mental deficiency as some kind of insult. Calling someone “Rainman” is to use autistic people as the punchline of a joke. We're a community that doesn't welcome such ableist slurs. The goal of the

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Tim Daneliuk
On 10/23/2013 10:53 PM, Ben Finney wrote: Right. Congratulations for learning more about the design of the OS and making a program that fits in well:-) It's only possible because, after some 30 years of doing this, I feel very abelist ... --

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Tim Daneliuk
On 10/23/2013 10:53 PM, Ben Finney wrote: Congratulations for learning more about the design of the OS and making a program that fits in well It's only because of some 30 years of doing this that I now feel quite abelist ... --

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread Ben Finney
Tim Daneliuk tun...@tundraware.com writes: On 10/23/2013 10:53 PM, Ben Finney wrote: Right. Congratulations for learning more about the design of the OS and making a program that fits in well:-) It's only possible because, after some 30 years of doing this, I feel very abelist ... You

Re: Reading from stdin first, then use curses

2013-09-04 Thread Veritatem Ignotam
I'd like to bump this. I asked a similar question a few weeks ago and had no reply. Here's my question: I'm fairly new to python and even newer to curses. Does any one have a good solution for how to embed the output of a subprocess (ex. subprocess.Popen(htop, stdout=subprocess.PIPE)) into an

Re: Reading from stdin first, then use curses

2013-09-04 Thread Antoon Pardon
Op 04-09-13 20:45, Veritatem Ignotam schreef: I'd like to bump this. I asked a similar question a few weeks ago and had no reply. Here's my question: I'm fairly new to python and even newer to curses. Does any one have a good solution for how to embed the output of a subprocess (ex.

Re: Reading from stdin first, then use curses

2013-09-01 Thread Antoon Pardon
Op 11-08-13 14:05, Timo Schmiade schreef: Hi all, I wrote a replacement for urlview to properly extract URLs from emails. You can find the first draft here: https://github.com/the-isz/pyurlview When I call it with an email file passed to the '-f' argument, it does pretty much what I want

Re: Reading from stdin first, then use curses

2013-08-31 Thread Timo Schmiade
Hi again, sorry for replying to my own mail, but is there really no solution? Can curses really not be used in this situation? Thanks again, Timo On Sun, Aug 11, 2013 at 02:05:11PM +0200, Timo Schmiade wrote: Hi all, I wrote a replacement for urlview to properly extract URLs from emails.

Reading from stdin first, then use curses

2013-08-11 Thread Timo Schmiade
Hi all, I wrote a replacement for urlview to properly extract URLs from emails. You can find the first draft here: https://github.com/the-isz/pyurlview When I call it with an email file passed to the '-f' argument, it does pretty much what I want already. However, I intend to use it in mutt,

Re: Reading from stdin (in windows)

2008-10-14 Thread Rob Williscroft
[EMAIL PROTECTED] wrote in news:mailman.2448.1223974725.3487.python- [EMAIL PROTECTED] in comp.lang.python: Hi! I wanna write a file processor in python (Windows XP). I wanna use pipe, and not parameters. When I write this: ... l = [] while 1: t = sys.stdin.read(1) if t

Reading from stdin (in windows)

2008-10-14 Thread [EMAIL PROTECTED]
Hi! I wanna write a file processor in python (Windows XP). I wanna use pipe, and not parameters. When I write this: ... l = [] while 1: t = sys.stdin.read(1) if t == '': break l.append(t) t = .join(l) ... and use code this: process.py test.txt I got: Bad file descriptor

Re: Reading from stdin

2008-10-14 Thread Gabriel Genellina
En Wed, 08 Oct 2008 10:28:55 -0300, Luis Zarrabeitia [EMAIL PROTECTED] escribió: And I may try to find next()'s implementation... I guess I'll be downloading python's source when my bandwidth allows it (or find it on a browseable repository) Try http://svn.python.org - in particular,

Re: Reading from stdin

2008-10-09 Thread Hendrik van Rooyen
Luis Zarrabeitia wrote: But it doesn't say how to put the file object in non-blocking mode. (I was trying to put the file object in non-blocking mode to test next()'s behavior). ??Ideas? # Some magic to make a file non blocking - from the internet def unblock(f): Given file 'f', sets its

Re: Reading from stdin

2008-10-08 Thread Almar Klein
I guess the phrasing hidden read-ahead buffer implies that buffering cannot be turned off (or at least it is not intended to even if it's somehow possible). I think it can be done, but you would have to use a different approach on linux than on windows. Linux requires fcntl (I dont know what

Re: Reading from stdin

2008-10-08 Thread Luis Zarrabeitia
On Tuesday 07 October 2008 11:27:19 pm George Sakkis wrote: In order to make a for loop the most efficient way of looping over the lines of a file (a very common operation), the next() method uses a hidden read-ahead buffer. As a consequence of using a read-ahead buffer, combining next()

Re: Reading from stdin

2008-10-08 Thread Jean-Paul Calderone
On Wed, 8 Oct 2008 09:28:55 -0400, Luis Zarrabeitia [EMAIL PROTECTED] wrote: On Tuesday 07 October 2008 11:27:19 pm George Sakkis wrote: In order to make a for loop the most efficient way of looping over the lines of a file (a very common operation), the next() method uses a hidden read-ahead

Reading from stdin

2008-10-07 Thread Luis Zarrabeitia
I have a problem with this piece of code: import sys for line in sys.stdin: print You said!, line Namely, it seems that the stdin buffers the input, so there is no reply until a huge amount of text has bin written. The iterator returned by xreadlines has the same behavior. The

Re: Reading from stdin

2008-10-07 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Luis Zarrabeitia wrote: I have a problem with this piece of code: import sys for line in sys.stdin: print You said!, line Namely, it seems that the stdin buffers the input, so there is no reply until a huge amount of text has bin written.

Re: Reading from stdin

2008-10-07 Thread George Sakkis
Luis Zarrabeitia wrote: I have a problem with this piece of code: import sys for line in sys.stdin: print You said!, line Namely, it seems that the stdin buffers the input, so there is no reply until a huge amount of text has bin written. The iterator returned by xreadlines

Re: Reading from stdin

2008-10-07 Thread Luis Zarrabeitia
On Tuesday 07 October 2008 05:33:18 pm George Sakkis wrote: Not an answer to your actual question, but you can keep the 'for' loop instead of rewriting it with 'while' using the iter(function, sentinel) idiom: for line in iter(sys.stdin.readline, ): print You said!, line You're right,

Re: Reading from stdin

2008-10-07 Thread Luis Zarrabeitia
On Tuesday 07 October 2008 05:12:28 pm Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Luis Zarrabeitia wrote: I have a problem with this piece of code: import sys for line in sys.stdin: print You said!, line Namely, it seems that the stdin buffers the

Re: Reading from stdin

2008-10-07 Thread George Sakkis
On Oct 7, 8:13 pm, Luis Zarrabeitia [EMAIL PROTECTED] wrote: On Tuesday 07 October 2008 05:33:18 pm George Sakkis wrote: Not an answer to your actual question, but you can keep the 'for' loop instead of rewriting it with 'while' using the iter(function, sentinel) idiom: for line in