You are here : python_2ososopenpty

os.openpty() - os

             

The method openpty() opens a pseudo-terminal pair and returns a pair of file descriptors(master,slave) for the pty & the tty respectively.


  • NA


Syntax


os.openpty()


Example


# !/usr/bin/python

import os

# master for pty, slave for tty
m,s = os.openpty()

print m
print s

# showing terminal name
s = os.ttyname(s)
print m
print s


Output / Return Value

When we run above program, it produces following result:


3 4 3 /dev/pty0


Limitations


Alternatives / See Also


Reference