python - Reading binary data from stdin -


Is it possible to read stdin as binary data in Python 2.6? if so, how?

I think this is quite easy, but 2.6 does not seem to be able to do this.

If these methods are described 3.1 are not available, is there a way to close and reopen the studin in binary mode?

Update

Just to be clear, I am using the contents of a binary file in my Python code to open MS-DOS for a pipe In 'type' This should be a UNIX 'cat' command, as far as I understand. But when I check it, I always get less than a byte expected file size.

Update # 2

First of all, thanks for everyone. I am slowly working towards a real, disposable solution. Finally, I am still trying to build a self contained JAR file which automatically passes my Python code through all command line arguments

This is because I have Java / JAR I'm going to Janeon route because only one of my main external libraries is available as Java jar. But unfortunately, I started my work as a dragon. It was easy to convert my code to Java some time ago, but when it was all to be compatible, I thought I would try trucking through it and it would prove that it can be done.

Anyone was thinking, even a few days ago I asked about the question.

Some of that question was answered on this.

I will try to update my original question with some notes which I have so far taken.

Use Python 2 to treat studin, standout and stadder as a binary unbarged stream .

  C: & gt; Type mydoc.txt | Python.exe -u myscript.py  

Comments