Python os.O_TEXT Examples

The following are 4 code examples of os.O_TEXT(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module os , or try the search function .
Example #1
Source File: test_Cosimulation.py    From myhdl with GNU Lesser General Public License v2.1 5 votes vote down vote up
def wtrf():
    if sys.platform != "win32":
        wt = int(os.environ['MYHDL_TO_PIPE'])
        rf = int(os.environ['MYHDL_FROM_PIPE'])
    else:
        wt = msvcrt.open_osfhandle(int(os.environ['MYHDL_TO_PIPE']), os.O_APPEND | os.O_TEXT)
        rf = msvcrt.open_osfhandle(int(os.environ['MYHDL_FROM_PIPE']), os.O_RDONLY | os.O_TEXT)

    return wt, rf 
Example #2
Source File: winutils.py    From LKD with 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 #3
Source File: ipc.py    From hupper with MIT License 5 votes vote down vote up
def open_handle(handle, mode):
        flags = 0
        if 'w' not in mode and '+' not in mode:
            flags |= os.O_RDONLY
        if 'b' not in mode:
            flags |= os.O_TEXT
        if 'a' in mode:
            flags |= os.O_APPEND
        return msvcrt.open_osfhandle(handle, flags) 
Example #4
Source File: winutils.py    From PythonForWindows with 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)
    kwargs = {}
    if windows.pycompat.is_py3 and flags == os.O_TEXT:
        # Buffering, encoding
        args = (100, "ascii")
    else:
        # Buffering
        args = (0,)
    # In py2 os.fdopen do not accept kwargs
    return os.fdopen(fd, mode, *args)