Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Cameron Simpson
On 28Dec2018 20:21, Daniel Ojalvo wrote: I agree that previous behavior shouldn't be changed, but I would suggest updating the documentation to point it out as a footnote. The current behavior is correct just unclear. Most people just learning about the open command wouldn't have this expectat

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 7:21 AM Daniel Ojalvo wrote: > > Thank you for the advice! > > I haven't used the opener argument before, but I'll keep it for future > reference. I think it's still a little kludge-y, but it works. It has a very similar effect to what you were proposing, but still works

RE: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Daniel Ojalvo via Python-list
nted issue: Open system call blocks on named pipes (and a feature request) On Fri, Dec 28, 2018 at 1:38 PM Daniel Ojalvo via Python-list wrote: > > Hello, > > I've been working on a python3 project and I came across an issue with the > open system call that, at the ver

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Chris Angelico
On Sat, Dec 29, 2018 at 4:24 AM Grant Edwards wrote: > > On 2018-12-27, Daniel Ojalvo via Python-list wrote: > > open("this_is_a_pipe") > > > > Opening a tty device can also block[1]. However, if somebody is using > the open() builtin on tty devices that's probably the least of their > prob

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-28 Thread Grant Edwards
On 2018-12-27, Daniel Ojalvo via Python-list wrote: open("this_is_a_pipe") > Opening a tty device can also block[1]. However, if somebody is using the open() builtin on tty devices that's probably the least of their problems. [1] Technically, opening any character-mode device could block

Re: Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-27 Thread Chris Angelico
On Fri, Dec 28, 2018 at 1:38 PM Daniel Ojalvo via Python-list wrote: > > Hello, > > I've been working on a python3 project and I came across an issue with the > open system call that, at the very least, isn't documented. In my humble > opinion, the > documentation

Undocumented issue: Open system call blocks on named pipes (and a feature request)

2018-12-27 Thread Daniel Ojalvo via Python-list
Hello, I've been working on a python3 project and I came across an issue with the open system call that, at the very least, isn't documented. In my humble opinion, the documentation should be updated because folks wouldn't expect open to be

Re: what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-28 Thread Cpcp Cp
https://docs.python.org/2/library/pipes.html -- https://mail.python.org/mailman/listinfo/python-list

Re: what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-28 Thread Steven D'Aprano
On Wednesday 28 September 2016 16:47, Cpcp Cp wrote: > Template.append(cmd, kind) and Template.prepend(cmd, kind) > Append a new action at the end.The cmd variable must be a valid bourne shell > command. The kind variable consists of two letters. "Append" means to put at the end. "Prepend" means

Re: what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-28 Thread Lawrence D’Oliveiro
On Wednesday, September 28, 2016 at 7:47:46 PM UTC+13, Cpcp Cp wrote: > My os is windows 7.But this module is used for POSIX. Windows 10 has a Linux layer, I believe. Why not try that? -- https://mail.python.org/mailman/listinfo/python-list

Re: what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-28 Thread Cpcp Cp
Please give me a simple example.Thanks! -- https://mail.python.org/mailman/listinfo/python-list

what's the difference of Template.append(...) and Template.prepend(...) in pipes module

2016-09-27 Thread Cpcp Cp
Template.append(cmd, kind) and Template.prepend(cmd, kind) Append a new action at the end.The cmd variable must be a valid bourne shell command. The kind variable consists of two letters. My os is windows 7.But this module is used for POSIX. So,I don't know the doucement said what's difference o

Re: Bash-like pipes in Python

2016-03-20 Thread Marko Rauhamaa
Steven D'Aprano : > On Thu, 17 Mar 2016 02:20 am, Random832 wrote: >> fpipe("abcd12345xyz", pfilter(str.isdigit), pmap(int), preduce(mul)) > > Intriguing! Thank you for the suggestion. Still want the pipeline syntax! Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Bash-like pipes in Python

2016-03-20 Thread Random832
On Wed, Mar 16, 2016, at 11:20, Random832 wrote: > How about: > > from functools import partial, reduce > from operator import mul > def rcall(arg, func): return func(arg) > def fpipe(*args): return reduce(rcall, args) It occurs to me that this suggests a further refinement: have all functions (a

Re: Bash-like pipes in Python

2016-03-19 Thread Sivan Greenberg
If I understand correctly, the binary right or overloading that's seen here can be applied to any other computational objects. I could also think of implementing it for input / output pipes overloading the __ror__ method with .communicate() method of the Popen object [0]. -Sivan [0]:

Re: Bash-like pipes in Python

2016-03-19 Thread Marko Rauhamaa
Sivan Greenberg : > If I understand correctly, the binary right or overloading that's seen > here can be applied to any other computational objects. > > I could also think of implementing it for input / output pipes > overloading the __ror__ method with .communicate() method o

Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 4:57 PM, Steven D'Aprano wrote: > There's a powerful technique used in shell-scripting languages like bash: > pipes. The output of one function is piped in to become the input to the > next function. > > According to Martin Fowler, this was

Re: Bash-like pipes in Python

2016-03-19 Thread Stefan Otte
I use the pipe style a lot, but one of the annoyances is that many functions in the python standardlib expect the first argument to be a callable and the second an iterable. I tend to write a lot of "p-functions" (functions which switch that order and make them compatible to `pipe`). from pelper

Re: Bash-like pipes in Python

2016-03-19 Thread Chris Angelico
On Thu, Mar 17, 2016 at 4:04 AM, Marko Rauhamaa wrote: > Question: Could the generators define __repr__ so you wouldn't need to > terminate the pipeline with "List" in interactive use? No no no no. You do NOT want __repr__ to fundamentally change the state of the object (which it would in that ca

Re: Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 04:04 am, Marko Rauhamaa wrote: > Steven D'Aprano : > >> Here is a way to do functional-programming-like pipelines to collect >> and transform values from an iterable: >> >> https://code.activestate.com/recipes/580625-collection-pipeline-in-python/ > > Nice. The other day we

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 10:57, Steven D'Aprano wrote: > For instance, we can take a string, extract all the digits, convert them > to > ints, and finally multiply the digits to give a final result: > > py> from operator import mul > py> "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(m

Re: Bash-like pipes in Python

2016-03-19 Thread Marko Rauhamaa
Steven D'Aprano : > Here is a way to do functional-programming-like pipelines to collect > and transform values from an iterable: > > https://code.activestate.com/recipes/580625-collection-pipeline-in-python/ Nice. The other day we talked about Python replacing bash. Pipelining is a big step in t

Re: Bash-like pipes in Python

2016-03-19 Thread Sivan Greenberg
++1 ! On Thu, Mar 17, 2016 at 6:31 PM, Random832 wrote: > > > On Thu, Mar 17, 2016, at 10:36, Chris Angelico wrote: > > This object has a generator/list duality, but if you observe it, it > > collapses to a list. When used interactively, it'd be pretty much the > > same as calling list() as the

Re: Bash-like pipes in Python

2016-03-19 Thread Christian Gollwitzer
Am 16.03.16 um 16:09 schrieb Joel Goldstick: On Wed, Mar 16, 2016 at 10:57 AM, Steven D'Aprano wrote: py> from operator import mul py> "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(mul) 120 This is interesting, but the part I'm missing is the use of the Pipe symbol '|' in python.

Re: Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
On Thu, 17 Mar 2016 02:20 am, Random832 wrote: > How about: > > from functools import partial, reduce > from operator import mul > def rcall(arg, func): return func(arg) > def fpipe(*args): return reduce(rcall, args) > pfilter = partial(partial, filter) > pmap = partial(partial, map) > preduce =

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 11:09, Joel Goldstick wrote: > > This is interesting, but the part I'm missing is the use of the Pipe > symbol '|' in python. Can you elaborate His "Filter", "Map", and "Reduce" are classes which define __ror__ methods, obviously. -- https://mail.python.org/mailman/listi

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Thu, Mar 17, 2016, at 10:36, Chris Angelico wrote: > This object has a generator/list duality, but if you observe it, it > collapses to a list. When used interactively, it'd be pretty much the > same as calling list() as the last step, but in a script, they'd > operate lazily. > > Quantum com

Bash-like pipes in Python

2016-03-19 Thread Steven D'Aprano
There's a powerful technique used in shell-scripting languages like bash: pipes. The output of one function is piped in to become the input to the next function. According to Martin Fowler, this was also used extensively in Smalltalk: http://martinfowler.com/articles/collection-pipeline/

Re: Bash-like pipes in Python

2016-03-19 Thread Omar Abou Mrad
On Wed, Mar 16, 2016 at 5:39 PM, Steven D'Aprano wrote: > On Thu, 17 Mar 2016 02:22 am, Omar Abou Mrad wrote: > > > Would be nice if this was possible: > > > get_digits = Filter(str.isdigit) | Map(int) > 'kjkjsdf399834' | get_digits > > > Yes it would. I'll work on that. > > > > Also, h

Re: Bash-like pipes in Python

2016-03-18 Thread Stefan Otte
I wrote this little lib "pelper" [0] which has the elixir inspired pipe [1]. I initially had an implementation that used operator overloading but found that the "|" syntax was not really necessary. I just use the function `pipe` [2] Some examples from the repo: ``pipe`` allows you to turn somethi

Re: Bash-like pipes in Python

2016-03-18 Thread Steven D'Aprano
On Thu, 17 Mar 2016 02:22 am, Omar Abou Mrad wrote: > Would be nice if this was possible: > get_digits = Filter(str.isdigit) | Map(int) 'kjkjsdf399834' | get_digits Yes it would. I'll work on that. > Also, how about using '>>' instead of '|' for "Forward chaining" Any particular re

Re: Bash-like pipes in Python

2016-03-18 Thread Joel Goldstick
On Wed, Mar 16, 2016 at 10:57 AM, Steven D'Aprano wrote: > There's a powerful technique used in shell-scripting languages like bash: > pipes. The output of one function is piped in to become the input to the > next function. > > According to Martin Fowler, this was

Re: Bash-like pipes in Python

2016-03-18 Thread Sven R. Kunze
On 16.03.2016 16:09, Joel Goldstick wrote: symbol '|' in python. Can you elaborate bitwise or -- https://mail.python.org/mailman/listinfo/python-list

Re: Bash-like pipes in Python

2016-03-18 Thread Chris Angelico
On Fri, Mar 18, 2016 at 1:10 AM, Steven D'Aprano wrote: > At the moment, the data being processed by the Map, Filter, etc. are > ordinary lists or iterators. In order to give them a customer __repr__, I > would have to change the Map and Filter __ror__ method to return some > custom type which beh

Re: Pipes

2015-08-11 Thread Tim Golden
On 11/08/2015 10:58, Laura Creighton wrote: The O'Reilly book Effective Computation in Physics that Larry Hudson recommended looks really good. It also occurs to me that another way to get familiar with the scientific python world is to attend a Scientific Python conference. EuroSciPy is the en

Re: Pipes

2015-08-11 Thread Laura Creighton
The O'Reilly book Effective Computation in Physics that Larry Hudson recommended looks really good. It also occurs to me that another way to get familiar with the scientific python world is to attend a Scientific Python conference. EuroSciPy is the end of this month in Cambridge. https://www.euro

Re: Pipes

2015-08-11 Thread Laura Creighton
out spending months or years learning >some programming language or comparing notes with one another. So, an >entire Python directory that made that possible and that had clear >instructions for how to open and close files and create "pipes" etc. would >get the job done. We

Re: Pipes

2015-08-10 Thread Larry Hudson via Python-list
On 08/10/2015 01:43 PM, E.D.G. wrote: [snip] It has been my experience that researchers, particularly scientists, need to have some versatile and powerful programming language available that is compatible with the Windows operating system. The language needs to make certain resources av

Re: Pipes

2015-08-10 Thread Mark Lawrence
years learning some programming language or comparing notes with one another. So, an entire Python directory that made that possible and that had clear instructions for how to open and close files and create "pipes" etc. would get the job done. http://ipython.org/notebook.html could b

Re: Pipes

2015-08-10 Thread E.D.G.
. The language needs to make certain resources available to the researchers. And in some form it should ultimately be compatible with other operating systems. Among the needed resources would be the ability to open and close files, read from and write to files, open "pipes"

Re: Pipes

2015-08-10 Thread Mark Lawrence
On 10/08/2015 15:05, rogerh...@gmail.com wrote: On Monday, August 10, 2015 at 7:45:28 AM UTC-6, Mark Lawrence wrote: On 10/08/2015 03:55, Roger Hunter wrote: I agree that some of Python is simple but the description of subprocess is certainly not. I spent much of my working career using Fortra

Re: Pipes

2015-08-10 Thread rogerh906
On Monday, August 10, 2015 at 7:45:28 AM UTC-6, Mark Lawrence wrote: > On 10/08/2015 03:55, Roger Hunter wrote: > > I agree that some of Python is simple but the description of subprocess > > is certainly not. > > > > I spent much of my working career using Fortran and TrueBasic on mainframes. > >

Re: Pipes

2015-08-10 Thread Mark Lawrence
On 10/08/2015 03:55, Roger Hunter wrote: I agree that some of Python is simple but the description of subprocess is certainly not. I spent much of my working career using Fortran and TrueBasic on mainframes. That's good. It means that you were probably taught to read and write from left to r

Re: Pipes

2015-08-10 Thread Chris Angelico
On Mon, Aug 10, 2015 at 12:55 PM, Roger Hunter wrote: > I agree that some of Python is simple but the description of subprocess is > certainly not. That's because spawning subprocesses is a complicated thing to do - or rather, it's a simple thing to do, but with a large number of options. This is

Re: Pipes

2015-08-10 Thread Roger Hunter
I agree that some of Python is simple but the description of subprocess is certainly not. I spent much of my working career using Fortran and TrueBasic on mainframes. I'd like programming to be more like holding a discussion to the computer in English instead of Sanscrit. Roger On Sun, Aug 9, 2

Re: Pipes

2015-08-09 Thread Cameron Simpson
convenience routes for the common cases of that interaction, such as the check-call() function. It does expect the user to have some familarity with pipes and the whole "process" model, and describes what it offers. If you want to make pipelines or do other higher level thing

Re: Pipes

2015-08-09 Thread Cameron Simpson
On 09Aug2015 17:44, Clayton Kirkwood wrote: But there is nothing non-cryptic and orderly that I have found that lists out various modules and packages. If you know the module, it generally gives most of the information, but if you don't know the module name or function capability, you're lost.

RE: Pipes

2015-08-09 Thread Clayton Kirkwood
> -Original Message- > From: Python-list [mailto:python-list- > bounces+crk=godblessthe...@python.org] On Behalf Of Dennis Lee Bieber > Sent: Sunday, August 09, 2015 1:43 PM > To: python-list@python.org > Subject: Re: Pipes > > On Sun, 9 Aug 2015 10:5

Re: Pipes

2015-08-09 Thread Cameron Simpson
On 09Aug2015 10:55, rogerh...@gmail.com wrote: But WOW! Python is described as an easy to learn language. I don't think so! The language itself is pretty compact and expressive. You also need to gain some familarity with the standard library that comes with it. That has lots of stuff. "subpr

Re: Pipes

2015-08-09 Thread Mark Lawrence
On 09/08/2015 21:43, Dennis Lee Bieber wrote: On Sun, 9 Aug 2015 10:55:36 -0700 (PDT), rogerh...@gmail.com declaimed the following: Nevermind, I found it. Thanks for the pointer. But WOW! Python is described as an easy to learn language. I don't think so! It is... The Language Refer

Re: Pipes

2015-08-09 Thread alister
On Sun, 09 Aug 2015 10:55:36 -0700, rogerh906 wrote: > On Sunday, August 9, 2015 at 8:11:18 AM UTC-6, roge...@gmail.com wrote: >> Just learning Python and have a question. >> >> Is it possible for Python to pass information to another program (in >> Windows), wait for that program to finish and t

Re: Pipes

2015-08-09 Thread Emile van Sebille
nforced indentation structure. Also, pipes and interprocess communications aren't usually CS101 level classes. The libraries are where things get interesting and where you should focus your attention. https://docs.python.org/2/library/ is the official docs, but effbot's guide, while

Re: Pipes

2015-08-09 Thread Mark Lawrence
On 09/08/2015 18:52, Ian Kelly wrote: On Sun, Aug 9, 2015 at 11:39 AM, wrote: Where can I find out about this? It's not mentioned in my "Introduction to Python" book. The Python documentation at docs.python.org are an important resource, and in particular the subprocess module is covered at

Re: Pipes

2015-08-09 Thread rogerh906
On Sunday, August 9, 2015 at 8:11:18 AM UTC-6, roge...@gmail.com wrote: > Just learning Python and have a question. > > Is it possible for Python to pass information to another program (in > Windows), wait for that program to finish and then resume operating? > > It's called a pipe in Unix syste

Re: Pipes

2015-08-09 Thread Ian Kelly
On Sun, Aug 9, 2015 at 11:39 AM, wrote: > Where can I find out about this? It's not mentioned in my "Introduction to > Python" book. The Python documentation at docs.python.org are an important resource, and in particular the subprocess module is covered at https://docs.python.org/3/library/sub

Re: Pipes

2015-08-09 Thread rogerh906
On Sunday, August 9, 2015 at 8:11:18 AM UTC-6, roge...@gmail.com wrote: > Just learning Python and have a question. > > Is it possible for Python to pass information to another program (in > Windows), wait for that program to finish and then resume operating? > > It's called a pipe in Unix syste

Re: Pipes

2015-08-09 Thread Ian Kelly
On Sun, Aug 9, 2015 at 8:10 AM, wrote: > Just learning Python and have a question. > > Is it possible for Python to pass information to another program (in > Windows), wait for that program to finish and then resume operating? > > It's called a pipe in Unix systems. Yes,

Pipes

2015-08-09 Thread rogerh906
Just learning Python and have a question. Is it possible for Python to pass information to another program (in Windows), wait for that program to finish and then resume operating? It's called a pipe in Unix systems. Thanks, Roger -- https://mail.python.org/mailman/listinfo/python-list

Re: Help with pipes, buffering and pseudoterminals

2015-04-07 Thread Gregory Ewing
Chris Angelico wrote: Really? I can believe that stdout and stderr are initially duplicates, but stdin as well? Isn't stdin opened for reading only, and stdout/stderr for writing only? It depends entirely on how the process that forked your shell process set things up, but a quick experiment I

Re: Help with pipes, buffering and pseudoterminals

2015-04-07 Thread Ian Kelly
On Tue, Apr 7, 2015 at 4:06 PM, Cameron Simpson wrote: > On 07Apr2015 20:38, Chris Angelico wrote: >> >> On Tue, Apr 7, 2015 at 3:48 PM, Cameron Simpson wrote: >>> >>> The operating system arranges the commection of the shell to the >>> terminal. >>> Your usual program has by default a stdin, st

Re: Help with pipes, buffering and pseudoterminals

2015-04-07 Thread Cameron Simpson
On 07Apr2015 20:38, Chris Angelico wrote: On Tue, Apr 7, 2015 at 3:48 PM, Cameron Simpson wrote: The operating system arranges the commection of the shell to the terminal. Your usual program has by default a stdin, stdout and stderr. These are _all_ the same file handle, duplicated to each of

Re: Help with pipes, buffering and pseudoterminals

2015-04-07 Thread Chris Angelico
On Tue, Apr 7, 2015 at 3:48 PM, Cameron Simpson wrote: > The operating system arranges the commection of the shell to the terminal. > Your usual program has by default a stdin, stdout and stderr. These are > _all_ the same file handle, duplicated to each of the three file descriptors > 0, 1 and 2

Re: Help with pipes, buffering and pseudoterminals

2015-04-06 Thread Cameron Simpson
On 06Apr2015 21:13, Daniel Ellis wrote: Wow, thank you for the long and detailed reply. As for the question ptys and C, no, I have no experience in that area. No worries. The use is the same in Python. BTW, you may want a fixed width font; there are some ASCII diagrams in this message. I

Re: Help with pipes, buffering and pseudoterminals

2015-04-06 Thread Daniel Ellis
Wow, thank you for the long and detailed reply. As for the question ptys and C, no, I have no experience in that area. I've read a bit on the master/slave stuff, but I'm still finding it confusing. The manpage for pty states that it creates a "pair" of virtual devices, one master and one slave.

Re: Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Cameron Simpson
On 05Apr2015 12:20, Daniel Ellis wrote: I have a small little tool I'd like to make. It essentially takes piped input, modifies the text in some way, and immediately prints the output. The problem I'm having is that any output I pipe to the program seems to be buffered, removing the desired

Re: Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Nobody
On Sun, 05 Apr 2015 12:20:48 -0700, Daniel Ellis wrote: > This only seems to print from the parent process. I read that I need to > do the os.read call for the fork to happen. I've also tried printing > *after* the os.read call. The child process has its std{in,out,err} attached to the newly-cr

Help with pipes, buffering and pseudoterminals

2015-04-05 Thread Daniel Ellis
I have a small little tool I'd like to make. It essentially takes piped input, modifies the text in some way, and immediately prints the output. The problem I'm having is that any output I pipe to the program seems to be buffered, removing the desired effect. >From what I understand, I need t

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-09 Thread Gregory Ewing
Luca Cerone wrote: Thanks! I managed to make it work using the threading library :) If at least one of the external programs can accept the source or destination as a filename argument instead of redirecting its stdin or stdout, you can also do something like this: import subprocess p2 = subp

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-06 Thread Luca Cerone
> my_thread.join() Thanks! I managed to make it work using the threading library :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread MRAB
On 05/08/2013 22:47, Luca Cerone wrote: You're back to using separate threads for the reader and the writer. And how do I create separate threads in Python? I was trying to use the threading library without not too success.. To run a function in a separate thread: import threading def my_f

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
> You're back to using separate threads for the reader and the writer. > And how do I create separate threads in Python? I was trying to use the threading library without not too success.. -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread MRAB
On 05/08/2013 17:54, Luca Cerone wrote: Thanks this works (if you add shell=True in Popen). If I don't want to use shell = True, how can I redirect the stdout to named_pipe? Popen accepts an open file handle for stdout, which I can't open for writing because that blocks the process... You're

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
Thanks this works (if you add shell=True in Popen). If I don't want to use shell = True, how can I redirect the stdout to named_pipe? Popen accepts an open file handle for stdout, which I can't open for writing because that blocks the process... > > > os.mkfifo("named_pipe", 0777) > > ls_proc

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Neil Cerutti
On 2013-08-05, Luca Cerone wrote: > I just would like to learn how to handle named pipes in Python, > which I find it easier to do by using a simple example that I > am comfortable to use :) Names pipes are a unix concept that saves you the hassle and limitations of writing to and readi

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread MRAB
x27;t use subprocess.Popen and pipe in the standard way. One of Ipython developers has suggested me to use named pipes as a temporary workaround. So I am taking the occasion to learn :) An alternative workaround is to use CPython. :-) If you're talking to another program, then that needs to

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
process.Popen and pipe in the standard way. One of Ipython developers has suggested me to use named pipes as a temporary workaround. So I am taking the occasion to learn :) > > If you're talking to another program, then that needs to be running > > already, waiting for the co

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
learn how to handle named pipes in Python, which I find it easier to do by using a simple example that I am comfortable to use :) Thanks in any case for your answer, Luca -- http://mail.python.org/mailman/listinfo/python-list

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread MRAB
On 05/08/2013 15:11, Luca Cerone wrote: Hi MRAB, thanks for the reply! Opening the pipe for reading will block until it's also opened for writing, and vice versa. OK. In your bash code, 'ls' blocked until you ran 'cat', but because you ran 'ls' in the background you didn't notice it! R

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Alister
On Mon, 05 Aug 2013 06:09:53 -0700, Luca Cerone wrote: > Hi everybody, > I am trying to understand how to use named pipes in python to launch > external processes (in a Linux environment). > > As an example I am trying to "imitate" the behaviour of the following &

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
Hi MRAB, thanks for the reply! > > Opening the pipe for reading will block until it's also opened for > > writing, and vice versa. > OK. > > > In your bash code, 'ls' blocked until you ran 'cat', but because you > > ran 'ls' in the background you didn't notice it! > > Right. > > In your

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread MRAB
On 05/08/2013 14:09, Luca Cerone wrote: Hi everybody, I am trying to understand how to use named pipes in python to launch external processes (in a Linux environment). As an example I am trying to "imitate" the behaviour of the following sets of commands is bash: mkfifo named_pi

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
Hi Paul, first of all thanks for the help. I am aware of the first solutions, just now I would like to experiment a bit with using named pipes (I also know that the example is trivial, but it just to grasp the main concepts) > > You can also pass a file object to p1's stdout and

Re: Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Paul Wiseman
On 5 August 2013 14:09, Luca Cerone wrote: > Hi everybody, > I am trying to understand how to use named pipes in python to launch > external processes (in a Linux environment). > > As an example I am trying to "imitate" the behaviour of the following sets > of co

Simulate `bash` behaviour using Python and named pipes.

2013-08-05 Thread Luca Cerone
Hi everybody, I am trying to understand how to use named pipes in python to launch external processes (in a Linux environment). As an example I am trying to "imitate" the behaviour of the following sets of commands is bash: > mkfifo named_pipe > ls -lah > named_pipe &

multiprocessing pipes with custom pickler

2013-06-18 Thread skunkwerk
Hi, I need inter-process communication in Python, and was looking at the documentation here: http://docs.python.org/2/library/multiprocessing.html I am using a custom pickler, though, in order to deal with some objects that are not serialize-able through the built-in pickler. Is there any wa

Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-02 Thread vasudevram
On Monday, September 3, 2012 1:05:03 AM UTC+5:30, vasudevram wrote: > > To Ian Kelly: > > No, that deals with actual Unix pipes. This appears to be about pipelined > > processing within a single program and not IPC; the description "Unix-like" > > is a bit mis

Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-02 Thread vasudevram
On Saturday, September 1, 2012 9:02:33 PM UTC+5:30, Ramchandra Apte wrote: > On Friday, 31 August 2012 03:27:54 UTC+5:30, vasudevram wrote: > > > I wrote PipeController recently to experiment with doing UNIX-style pipes > > in Python. > > > Doesn't the pipes

Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-01 Thread Ian Kelly
Resending to the list... On Sep 1, 2012 12:19 PM, "Ian Kelly" wrote: > On Sep 1, 2012 9:37 AM, "Ramchandra Apte" wrote: > > Doesn't the pipes module already do this? > > No, that deals with actual Unix pipes. This appears to be about pipelined > pro

Re: PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-09-01 Thread Ramchandra Apte
On Friday, 31 August 2012 03:27:54 UTC+5:30, vasudevram wrote: > I wrote PipeController recently to experiment with doing UNIX-style pipes in > Python. > > > > Blog post about it: > > > > http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating

PipeController v0.1 - experimental tool to simulate simple UNIX-style pipes in Python

2012-08-30 Thread vasudevram
I wrote PipeController recently to experiment with doing UNIX-style pipes in Python. Blog post about it: http://jugad2.blogspot.in/2012/08/pipecontroller-v01-released-simulating.html The blog post has a link to the downloadable PipeController source code. It will be released under the New

Re: help needed with subprocess, pipes and parameters

2012-07-17 Thread John Pote
nuffi, Have you tried running your piped commands c:\Programs\bob\bob.exe -x -y "C:\text\path\to some\file.txt" | c:\Programs\kate\kate.exe -A 2 --dc "Print Media Is Dead" --da "Author" --dt "Title" --hf "Times" --bb "14" --aa "" --font "Ariel" - "C:\rtf\path\to some\file.rtf" in a single i

Re: help needed with subprocess, pipes and parameters

2012-07-14 Thread Chris Rebert
On Friday, July 13, 2012, nuffi wrote: > > If I copy and paste the following command into a command window, it does > what I need. > > c:\Programs\bob\bob.exe -x -y "C:\text\path\to some\file.txt" | > c:\Programs\kate\kate.exe -A 2 --dc "Print Media Is Dead" --da "Author" > --dt "Title" --hf "Ti

help needed with subprocess, pipes and parameters

2012-07-13 Thread nuffi
If I copy and paste the following command into a command window, it does what I need. c:\Programs\bob\bob.exe -x -y "C:\text\path\to some\file.txt" | c:\Programs\kate\kate.exe -A 2 --dc "Print Media Is Dead" --da "Author" --dt "Title" --hf "Times" --bb "14" --aa "" --font "Ariel" - "C:\rtf

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Ethan Furman
Nobody wrote: On Thu, 09 Sep 2010 12:23:17 -0700, Ethan Furman wrote: basically a Queue is a syncronization primitive used to share and pass data to and from parent/child processes. A pipe is as the name suggests, a socket pair connected end-to-end allowing for full-duplex communications. Isn

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Nobody
On Thu, 09 Sep 2010 12:23:17 -0700, Ethan Furman wrote: >> basically a Queue is a syncronization primitive used to >> share and pass data to and from parent/child processes. >> >> A pipe is as the name suggests, a socket pair connected >> end-to-end allowing for full-duplex communications. >> >

Re: Difference between queues and pipes in multiprocessing

2010-09-09 Thread Ethan Furman
James Mills wrote: On Wed, Aug 4, 2010 at 7:20 PM, Navkirat Singh wrote: I was wondering what are the differences between queues and pipes implemented using multiprocessing python module. Am I correct if I say, in pipes, if another process writes to one receiving end concurrently, then an

Re: Difference between queues and pipes in multiprocessing

2010-08-04 Thread James Mills
On Wed, Aug 4, 2010 at 7:20 PM, Navkirat Singh wrote: > I was wondering what are the differences between queues and pipes implemented > using multiprocessing python module. Am I correct if I say, in pipes, if > another process writes to one receiving end concurrently, then an error w

Difference between queues and pipes in multiprocessing

2010-08-04 Thread Navkirat Singh
Hi, I was wondering what are the differences between queues and pipes implemented using multiprocessing python module. Am I correct if I say, in pipes, if another process writes to one receiving end concurrently, then an error will be raised and in queues the later processes data will just

Re: Writing to open subprocess pipes.

2010-06-16 Thread Nobody
On Wed, 16 Jun 2010 16:29:42 -0400, Brandon McGinty wrote: > Both subprocess and os.popen* only allow inputput and output one time, > and the output to be read only when the process terminates. This is incorrect; you can read from and write to the pipe as you wish. However: you may have problems

Re: Writing to open subprocess pipes.

2010-06-16 Thread Brandon McGinty
Ah. Thank you all for your quick responses. I shall implement non-blocking stdin/stdout objects, then. Thank You, Brandon McGinty On 6/16/2010 5:37 PM, Thomas Jollans wrote: On 06/16/2010 10:29 PM, Brandon McGinty wrote: All, I have researched this both in the python documentation, and via

  1   2   >