Python os.O_TEXT() Examples

The following are code examples for showing how to use os.O_TEXT(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: LKD   Author: sogeti-esec-lab   File: winutils.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def create_file_from_handle(handle, mode="r"):
    """Return a Python :class:`file` arround a windows HANDLE"""
    fd = msvcrt.open_osfhandle(handle, os.O_TEXT)
    return os.fdopen(fd, mode, 0) 
Example 2
Project: PythonForWindows   Author: hakril   File: winutils.py    BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def create_file_from_handle(handle, mode="r"):
    """Return a Python :class:`file` around a ``Windows`` HANDLE"""
    flags = os.O_BINARY if "b" in mode else os.O_TEXT
    fd = msvcrt.open_osfhandle(handle, flags)
    return os.fdopen(fd, mode, 0)