diff options
author | Xiang Zhang <angwerzx@126.com> | 2018-01-31 15:50:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 15:50:50 (GMT) |
commit | a29ddf407831c9103e4df4850df6d67b4352f4f9 (patch) | |
tree | 3d72643afe7e129548c04f224e9d233aaf32f339 | |
parent | 2c7fd46e11333ef5e5cce34212f7d087694f3658 (diff) | |
download | cpython-a29ddf407831c9103e4df4850df6d67b4352f4f9.zip cpython-a29ddf407831c9103e4df4850df6d67b4352f4f9.tar.gz cpython-a29ddf407831c9103e4df4850df6d67b4352f4f9.tar.bz2 |
Make site documentation more clear (#5461)
Mention only ImportError caused by importing sitecustomize.py/usercustomize.py
themselves will be silently ignored.
-rw-r--r-- | Doc/library/site.rst | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Doc/library/site.rst b/Doc/library/site.rst index 43daf79..ae40813 100644 --- a/Doc/library/site.rst +++ b/Doc/library/site.rst @@ -97,12 +97,12 @@ not mentioned in either path configuration file. After these path manipulations, an attempt is made to import a module named :mod:`sitecustomize`, which can perform arbitrary site-specific customizations. It is typically created by a system administrator in the site-packages -directory. If this import fails with an :exc:`ImportError` exception, it is -silently ignored. If Python is started without output streams available, as +directory. If this import fails with an :exc:`ImportError` or its subclass +exception, and the exception's :attr:`name` attribute equals to ``'sitecustomize'``, +it is silently ignored. If Python is started without output streams available, as with :file:`pythonw.exe` on Windows (which is used by default to start IDLE), -attempted output from :mod:`sitecustomize` is ignored. Any exception other -than :exc:`ImportError` causes a silent and perhaps mysterious failure of the -process. +attempted output from :mod:`sitecustomize` is ignored. Any other exception +causes a silent and perhaps mysterious failure of the process. .. index:: module: usercustomize @@ -110,7 +110,9 @@ After this, an attempt is made to import a module named :mod:`usercustomize`, which can perform arbitrary user-specific customizations, if :data:`ENABLE_USER_SITE` is true. This file is intended to be created in the user site-packages directory (see below), which is part of ``sys.path`` unless -disabled by :option:`-s`. An :exc:`ImportError` will be silently ignored. +disabled by :option:`-s`. If this import fails with an :exc:`ImportError` or +its subclass exception, and the exception's :attr:`name` attribute equals to +``'usercustomize'``, it is silently ignored. Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` are empty, and the path manipulations are skipped; however the import of |