Bad file descriptor

Cameron Simpson cs at
Fri Nov 14 08:42:40 CET 2014

On 13Nov2014 15:40, satishmlmlml at <satishmlmlml at> wrote:
>import os
>os.write(1, b'Hello descriptor world\n')
>OSError: Bad file descriptor
>How to give a file descriptor number to this function? How to get a file descriptor number?

Wow, this must be at least the 4th post of the same question.
It now occurs to me that a newer Python won't help you.

Are you running this at a command prompt?
Or are you running this in some IDE?

The reason I ask this question is that at a command prompt, the above would 
probably work.

In short, please provide more context. What OS? What version of Python? What 
environment (command prompt, IDE (which one?), a standalone script, etc)?

Cameron Simpson <cs at>

Louis Pasteur's theory of germs is ridiculous fiction.
       --Pierre Pachet, Professor of Physiology at Toulouse, 1872

More information about the Python-list mailing list