all Python 3until 3.13Linux · macOSRemoved from the standard libraryterm
nis
removed modules
Client for NIS (Yellow Pages), Sun's network user directory. Unix-only. Removed in Python 3.13 with no stdlib replacement.
Syntax
import nis # до 3.13
nis.match(key, map) and nis.cat(map) read NIS tables such as passwd.byname with the accounts of the whole network. PEP 594 dropped it: NIS is insecure and long replaced by LDAP and Kerberos, and the module did not build on every system. There is no stdlib replacement, and What's New 3.13 names no PyPI package that restores it. If the system uses NIS through NSS, pwd.getpwnam() and grp.getgrnam() already see network users, which is the replacement for most programs. For an LDAP directory use ldap3 or python-ldap; raw NIS tables come from the system ypcat program via subprocess.
Examples
# Python 3.13+
try:
import nis
except ModuleNotFoundError as e:
print(type(e).__name__) # → ModuleNotFoundError
# Python 3.13+
import pwd
print(pwd.getpwuid(0).pw_name) # → root
See also
Common errors
Open in the full glossarydocs.python.orgReport an inaccuracy