stdout - How to obtain the file descriptor of the current terminal in python? -


sys.__stdout__.fileno() returns file descriptor of terminal window python terminal session begins in.

but if bootstrap process closes file or file never existed begin with, how create new fd current terminal window can like:

sys.__stdout__ = os.fdopen(new_fd, 'w') sys.__stdout__.write('hi\r\n') 'hi' 


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -