Simulate `bash` behaviour using Python and named pipes.

Luca Cerone luca.cerone at gmail.com
Mon Aug 5 10:59:04 EDT 2013


Hi Alister,
> Are you sure you are using the correct tool for the task?

Yes. For two reasons: 1. I want to learn how to do this in Python :) 2. for an application I have in mind I will need to run external tools (not developed by me) and process the output using some tools that I have written in Python.

For technical reasons I can't use the subprocess.communicate() (the output to process is very large) method, and due to a bug in the interactive shell I am using (https://github.com/ipython/ipython/issues/3884) I cannot pipe processes just using the standard subprocess.Popen() approach.

> 
> I tend to find that in most cases if you are trying to execute bash 
> 
> commands from Python you are doing it wrong.

As I said, the example in my question is just for learning purposes, I don't want to reproduce ls and cat in Python...

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 :)

Thanks in any case for your answer,
Luca



More information about the Python-list mailing list