chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
2440f4ee-b134-542e-a761-aecd42a8d504 | docs | python | python_exceptions | 315 | 37 | pipe while the other end has been closed, or trying to write on a socket
which has been shutdown for writing.
Corresponds to `errno` [`EPIPE`](errno.html#errno.EPIPE "errno.EPIPE") and [`ESHUTDOWN`](errno.html#errno.ESHUTDOWN "errno.ESHUTDOWN").
*exception* ConnectionAbortedError[¶](#ConnectionAbortedError... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
d7bd5178-17d2-52ac-8d48-0ec5b172ca93 | docs | python | python_exceptions | 315 | 38 | : A subclass of [`ConnectionError`](#ConnectionError "ConnectionError"), raised when a connection is
reset by the peer.
Corresponds to `errno` [`ECONNRESET`](errno.html#errno.ECONNRESET "errno.ECONNRESET").
*exception* FileExistsError[¶](#FileExistsError "Link to this definition")
: Raised when trying to c... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
432dada5-1ca9-5f87-8d3c-469ab49651e1 | docs | python | python_exceptions | 315 | 39 | signal, except if the signal handler raises an exception (see [**PEP 475**](https://peps.python.org/pep-0475/)
for the rationale), instead of raising [`InterruptedError`](#InterruptedError "InterruptedError").
*exception* IsADirectoryError[¶](#IsADirectoryError "Link to this definition")
: Raised when a file... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
d0b7ac50-7cfd-59b0-b648-9264e58e3432 | docs | python | python_exceptions | 315 | 40 | *exception* PermissionError[¶](#PermissionError "Link to this definition")
: Raised when trying to run an operation without the adequate access
rights - for example filesystem permissions.
Corresponds to `errno` [`EACCES`](errno.html#errno.EACCES "errno.EACCES"),
[`EPERM`](errno.html#errno.EPERM "errno.EP... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
f3dc2243-a44e-5b8e-a102-8dc741fd34cc | docs | python | python_exceptions | 315 | 41 | Added in version 3.3: All the above [`OSError`](#OSError "OSError") subclasses were added.
See also
[**PEP 3151**](https://peps.python.org/pep-3151/) - Reworking the OS and IO exception hierarchy
## Warnings[¶](#warnings "Link to this heading")
The following exceptions are used as warning categories; see the
[Warni... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
4495ab79-d66f-5e1f-87a3-9df16786eaa5 | docs | python | python_exceptions | 315 | 42 | this warning.
The deprecation policy is described in [**PEP 387**](https://peps.python.org/pep-0387/).
*exception* PendingDeprecationWarning[¶](#PendingDeprecationWarning "Link to this definition")
: Base class for warnings about features which are obsolete and
expected to be deprecated in the future, b... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
1e70a3a2-646c-51a9-8476-5b247719f1d1 | docs | python | python_exceptions | 315 | 43 | This warning is typically emitted when compiling Python source code, and usually won’t be reported
when running already compiled code.
*exception* RuntimeWarning[¶](#RuntimeWarning "Link to this definition")
: Base class for warnings about dubious runtime behavior.
*exception* FutureWarning[¶](#FutureWarnin... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
abc734bb-1082-5985-98a6-f41ff7476404 | docs | python | python_exceptions | 315 | 44 | See [Opt-in EncodingWarning](io.html#io-encoding-warning) for details.
Added in version 3.10.
*exception* BytesWarning[¶](#BytesWarning "Link to this definition")
: Base class for warnings related to [`bytes`](stdtypes.html#bytes "bytes") and [`bytearray`](stdtypes.html#bytearray "bytearray").
*exception* ... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
a1db86fc-191e-5ddf-b9c7-fa7363dbf956 | docs | python | python_exceptions | 315 | 45 | their subgroups based on the types of the contained exceptions.
*exception* ExceptionGroup(*msg*, *excs*)[¶](#ExceptionGroup "Link to this definition")
*exception* BaseExceptionGroup(*msg*, *excs*)[¶](#BaseExceptionGroup "Link to this definition")
: Both of these exception types wrap the exceptions in the sequence ... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
ccc66923-eaf8-597e-a751-d407499c1d5b | docs | python | python_exceptions | 315 | 46 | The [`BaseExceptionGroup`](#BaseExceptionGroup "BaseExceptionGroup") constructor returns an [`ExceptionGroup`](#ExceptionGroup "ExceptionGroup")
rather than a [`BaseExceptionGroup`](#BaseExceptionGroup "BaseExceptionGroup") if all contained exceptions are
[`Exception`](#Exception "Exception") instances, so ... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
bf39c7ee-0a60-5d2a-b540-4fb9cd82ed21 | docs | python | python_exceptions | 315 | 47 | exceptions[¶](#BaseExceptionGroup.exceptions "Link to this definition")
: A tuple of the exceptions in the `excs` sequence given to the
constructor. This is a read-only attribute.
subgroup(*condition*)[¶](#BaseExceptionGroup.subgroup "Link to this definition")
: Returns an exception group t... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
62f80940-4eef-5e41-8689-9610d1bbd0fe | docs | python | python_exceptions | 315 | 48 | as are the values of its [`message`](#BaseExceptionGroup.message "BaseExceptionGroup.message"),
[`__traceback__`](#BaseException.__traceback__ "BaseException.__traceback__"), [`__cause__`](#BaseException.__cause__ "BaseException.__cause__"),
[`__context__`](#BaseException.__context__ "BaseExcept... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
62b16fd9-fc1e-55e2-b07f-3adb8f1f43ab | docs | python | python_exceptions | 315 | 49 | : Like [`subgroup()`](#BaseExceptionGroup.subgroup "BaseExceptionGroup.subgroup"), but returns the pair `(match, rest)` where `match`
is `subgroup(condition)` and `rest` is the remaining non-matching
part.
derive(*excs*)[¶](#BaseExceptionGroup.derive "Link to this definition")
: Returns... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
b3270967-61bc-5906-b1d0-3dfed5eea72a | docs | python | python_exceptions | 315 | 50 | than [`ExceptionGroup`](#ExceptionGroup "ExceptionGroup").
[`subgroup()`](#BaseExceptionGroup.subgroup "BaseExceptionGroup.subgroup") and [`split()`](#BaseExceptionGroup.split "BaseExceptionGroup.split") copy the
[`__traceback__`](#BaseException.__traceback__ "BaseException.__traceback__"),
... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
2cdbed45-6f97-5d3b-b5e1-baf8692fcbee | docs | python | python_exceptions | 315 | 51 | >>> e = MyGroup("eg", [ValueError(1), TypeError(2)])
>>> e.add_note("a note")
>>> e.__context__ = Exception("context")
>>> e.__cause__ = Exception("cause")
>>> try:
... raise e
... except Exception as e:
... exc = e
...
>>> match, res... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
850941d2-a1b9-5e59-8694-e7f2ede76cd8 | docs | python | python_exceptions | 315 | 52 | Note that [`BaseExceptionGroup`](#BaseExceptionGroup "BaseExceptionGroup") defines [`__new__()`](../reference/datamodel.html#object.__new__ "object.__new__"), so
subclasses that need a different constructor signature need to
override that rather than [`__init__()`](../reference/datamodel.html#object.__init_... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
ef01ff83-2524-5d44-9b9a-adc6c98fc93c | docs | python | python_exceptions | 315 | 53 | is also a subclass of [`Exception`](#Exception "Exception") can only wrap instances of
[`Exception`](#Exception "Exception").
Added in version 3.11.
## Exception hierarchy[¶](#exception-hierarchy "Link to this heading")
The class hierarchy for built-in exceptions is:
```None
BaseException
├── BaseExcep... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
6927abdb-3214-5067-b8de-4484730c4634 | docs | python | python_exceptions | 315 | 54 | │ │ ├── ConnectionAbortedError
│ │ ├── ConnectionRefusedError
│ │ └── ConnectionResetError
│ ├── FileExistsError
│ ├── FileNotFoundError
│ ├── InterruptedError
│ ├── IsADirectoryError
│ ├── NotADirectoryError
│ ├── PermissionError... | large_dataset/raw/docs/python/exceptions/exceptions_315.md |
0771f3aa-4688-5e27-8b6c-8aeb7c905b41 | docs | python | python_exceptions | 315 | 55 | ├── ImportWarning
├── PendingDeprecationWarning
├── ResourceWarning
├── RuntimeWarning
├── SyntaxWarning
├── UnicodeWarning
└── UserWarning
```
| large_dataset/raw/docs/python/exceptions/exceptions_315.md |
9029f617-486b-51c4-aa5e-89c11cc830b3 | docs | python | python_exceptions | 38 | 0 | # Built-in Exceptions¶
Source: https://docs.python.org/3.8/library/exceptions.html
Version: 3.8
In Python, all exceptions must be instances of a class that derives from
[`BaseException`](#BaseException "BaseException"). In a [`try`](../reference/compound_stmts.html#try) statement with an [`except`](../reference/compo... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
d38a4340-5de3-5ce6-9a8f-47dee6c0ea4c | docs | python | python_exceptions | 38 | 1 | class’s constructor.
User code can raise built-in exceptions. This can be used to test an exception
handler or to report an error condition “just like” the situation in which the
interpreter raises the same exception; but beware that there is nothing to
prevent user code from raising an inappropriate error.
The built... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
0a23b7e7-ad13-5632-9e62-8b2f13579d96 | docs | python | python_exceptions | 38 | 2 | new exception is not handled the traceback that is eventually displayed will
include the originating exception(s) and the final exception.
When raising a new exception (rather than using a bare `raise` to re-raise
the exception currently being handled), the implicit exception context can be
supplemented with an explic... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
3db8c00a-85bb-5ddb-9d28-50178bdb717a | docs | python | python_exceptions | 38 | 3 | leaving the old exception available in `__context__` for introspection
when debugging.
The default traceback display code shows these chained exceptions in
addition to the traceback for the exception itself. An explicitly chained
exception in `__cause__` is always shown when present. An implicitly
chained exception in... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
16a8d4dd-a39c-5f06-9da8-bf34f0d97804 | docs | python | python_exceptions | 38 | 4 | [`str()`](stdtypes.html#str "str") is called on an instance of this class, the representation of
the argument(s) to the instance are returned, or the empty string when
there were no arguments.
`args`[¶](#BaseException.args "Permalink to this definition")
: The tuple of arguments given to the exce... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
ff50fb57-e447-59bf-a12f-6a6c557620ae | docs | python | python_exceptions | 38 | 5 | raise OtherException(...).with_traceback(tb)
```
*exception* `Exception`[¶](#Exception "Permalink to this definition")
: All built-in, non-system-exiting exceptions are derived from this class. All
user-defined exceptions should also be derived from this class.
*exception* `ArithmeticError`[... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
6e5af9f8-8fa4-5771-959a-c87ec86e3e8c | docs | python | python_exceptions | 38 | 6 | a mapping or sequence is invalid: [`IndexError`](#IndexError "IndexError"), [`KeyError`](#KeyError "KeyError"). This
can be raised directly by [`codecs.lookup()`](codecs.html#codecs.lookup "codecs.lookup").
## Concrete exceptions[¶](#concrete-exceptions "Permalink to this headline")
The following exceptions a... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
fe8bf7e3-3c5d-5dae-9a69-106fc9e21377 | docs | python | python_exceptions | 38 | 7 | : Raised when the [`input()`](functions.html#input "input") function hits an end-of-file condition (EOF)
without reading any data. (N.B.: the `io.IOBase.read()` and
[`io.IOBase.readline()`](io.html#io.IOBase.readline "io.IOBase.readline") methods return an empty string when they hit EOF.)
*exception* `Floati... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
9119f397-3a31-500a-b67a-dd142bcb230b | docs | python | python_exceptions | 38 | 8 | *exception* `ImportError`[¶](#ImportError "Permalink to this definition")
: Raised when the [`import`](../reference/simple_stmts.html#import) statement has troubles trying to
load a module. Also raised when the “from list” in `from ... import`
has a name that cannot be found.
The `name` and `path` attrib... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
88c4e3a8-758f-5559-9078-4d2fb4c22c81 | docs | python | python_exceptions | 38 | 9 | *exception* `IndexError`[¶](#IndexError "Permalink to this definition")
: Raised when a sequence subscript is out of range. (Slice indices are
silently truncated to fall in the allowed range; if an index is not an
integer, [`TypeError`](#TypeError "TypeError") is raised.)
*exception* `KeyError`[¶](#KeyError ... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
991e3108-0749-5f7f-a8df-712955cbffea | docs | python | python_exceptions | 38 | 10 | : Raised when an operation runs out of memory but the situation may still be
rescued (by deleting some objects). The associated value is a string indicating
what kind of (internal) operation ran out of memory. Note that because of the
underlying memory management architecture (C’s `malloc()` function), th... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
b60b1372-af29-5e44-96dd-a95a2c9fc35c | docs | python | python_exceptions | 38 | 11 | classes, abstract methods should raise this exception when they require
derived classes to override the method, or while the class is being
developed to indicate that the real implementation still needs to be added.
Note
It should not be used to indicate that an operator or method is not
meant... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
6cfd42f2-d5e8-5805-8628-ca7f107615d1 | docs | python | python_exceptions | 38 | 12 | error, including I/O failures such as “file not found” or “disk full”
(not for illegal argument types or other incidental errors).
The second form of the constructor sets the corresponding attributes,
described below. The attributes default to [`None`](constants.html#None "None") if not
specified. ... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
89110b69-3dc6-53d6-b2d4-8553bfe03d10 | docs | python | python_exceptions | 38 | 13 | : A numeric error code from the C variable `errno`.
`winerror`[¶](#OSError.winerror "Permalink to this definition")
: Under Windows, this gives you the native
Windows error code. The [`errno`](#OSError.errno "OSError.errno") attribute is then an approximate
translation, in POSIX terms, ... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
7722d70d-b45e-5cbe-8944-b4b1bcf550c8 | docs | python | python_exceptions | 38 | 14 | `filename`[¶](#OSError.filename "Permalink to this definition")
`filename2`[¶](#OSError.filename2 "Permalink to this definition")
: For exceptions that involve a file system path (such as [`open()`](functions.html#open "open") or
[`os.unlink()`](os.html#os.unlink "os.unlink")), [`filename`](#OSEr... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
4fb47a83-1411-5262-b074-2677694ed50b | docs | python | python_exceptions | 38 | 15 | constructor may return a subclass.
Changed in version 3.4: The [`filename`](#OSError.filename "OSError.filename") attribute is now the original file name passed to
the function, instead of the name encoded to or decoded from the
filesystem encoding. Also, the *filename2* constructor argument and
at... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
6659d3cc-145f-5954-bc98-e354bb1ead74 | docs | python | python_exceptions | 38 | 16 | : This exception is derived from [`RuntimeError`](#RuntimeError "RuntimeError"). It is raised when the
interpreter detects that the maximum recursion depth (see
[`sys.getrecursionlimit()`](sys.html#sys.getrecursionlimit "sys.getrecursionlimit")) is exceeded.
New in version 3.5: Previously, a plain [`Runt... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
503c7119-4d74-5d22-ab50-abf16a9f313b | docs | python | python_exceptions | 38 | 17 | categories. The associated value is a string indicating what precisely went
wrong.
*exception* `StopIteration`[¶](#StopIteration "Permalink to this definition")
: Raised by built-in function [`next()`](functions.html#next "next") and an [iterator](../glossary.html#term-iterator)’s
[`__next__()`](stdtypes... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
8ecf60ec-fe3b-5f4e-8726-da70135665c8 | docs | python | python_exceptions | 38 | 18 | If a generator code directly or indirectly raises [`StopIteration`](#StopIteration "StopIteration"),
it is converted into a [`RuntimeError`](#RuntimeError "RuntimeError") (retaining the
[`StopIteration`](#StopIteration "StopIteration") as the new exception’s cause).
Changed in version 3.3: Added `value... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
add04e90-c4db-5b63-ac98-619446e1021e | docs | python | python_exceptions | 38 | 19 | : Must be raised by [`__anext__()`](../reference/datamodel.html#object.__anext__ "object.__anext__") method of an
[asynchronous iterator](../glossary.html#term-asynchronous-iterator) object to stop the iteration.
New in version 3.5.
*exception* `SyntaxError`[¶](#SyntaxError "Permalink to this definition")
:... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
c537cce8-c56e-5c45-bbd9-46bcd6858dbd | docs | python | python_exceptions | 38 | 20 | : Which line number in the file the error occurred in. This is
1-indexed: the first line in the file has a `lineno` of 1.
`offset`[¶](#SyntaxError.offset "Permalink to this definition")
: The column in the line where the error occurred. This is
1-indexed: the first character in the line... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
f9bf79df-04f2-5107-9037-080a0d597fc1 | docs | python | python_exceptions | 38 | 21 | : Raised when the interpreter finds an internal error, but the situation does not
look so serious to cause it to abandon all hope. The associated value is a
string indicating what went wrong (in low-level terms).
You should report this to the author or maintainer of your Python interpreter.
Be sure t... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
372fc5df-820f-5d98-9bec-2a61e1a147af | docs | python | python_exceptions | 38 | 22 | properly propagate up and cause the interpreter to exit. When it is not
handled, the Python interpreter exits; no stack traceback is printed. The
constructor accepts the same optional argument passed to [`sys.exit()`](sys.html#sys.exit "sys.exit").
If the value is an integer, it specifies the system exi... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
9d57f25b-5220-5fa5-bdce-dd1ddfb66d84 | docs | python | python_exceptions | 38 | 23 | absolutely positively necessary to exit immediately (for example, in the child
process after a call to [`os.fork()`](os.html#os.fork "os.fork")).
`code`[¶](#SystemExit.code "Permalink to this definition")
: The exit status or error message that is passed to the constructor.
(Defaults to `None... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
9e30e476-a31d-5329-9ed8-25a7ae36e419 | docs | python | python_exceptions | 38 | 24 | [`int`](functions.html#int "int") is expected) should result in a [`TypeError`](#TypeError "TypeError"), but passing
arguments with the wrong value (e.g. a number outside expected boundaries)
should result in a [`ValueError`](#ValueError "ValueError").
*exception* `UnboundLocalError`[¶](#UnboundLocalError ... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
ff8b8265-709e-5844-8c15-8462c24429ee | docs | python | python_exceptions | 38 | 25 | `encoding`[¶](#UnicodeError.encoding "Permalink to this definition")
: The name of the encoding that raised the error.
`reason`[¶](#UnicodeError.reason "Permalink to this definition")
: A string describing the specific codec error.
`object`[¶](#UnicodeError.object "Permalink to this definition... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
a8153e2f-2451-527c-9e49-2ac634ae4528 | docs | python | python_exceptions | 38 | 26 | : Raised when a Unicode-related error occurs during decoding. It is a subclass of
[`UnicodeError`](#UnicodeError "UnicodeError").
*exception* `UnicodeTranslateError`[¶](#UnicodeTranslateError "Permalink to this definition")
: Raised when a Unicode-related error occurs during translating. It is a subclass
o... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
a73e44c8-0a74-568f-8f02-236066171374 | docs | python | python_exceptions | 38 | 27 | starting from Python 3.3, they are aliases of [`OSError`](#OSError "OSError").
*exception* `EnvironmentError`[¶](#EnvironmentError "Permalink to this definition")
*exception* `IOError`[¶](#IOError "Permalink to this definition")
*exception* `WindowsError`[¶](#WindowsError "Permalink to this definition")
: Only ava... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
6536d219-e764-5943-a85b-1f901a3ff64c | docs | python | python_exceptions | 38 | 28 | `characters_written`[¶](#BlockingIOError.characters_written "Permalink to this definition")
: An integer containing the number of characters written to the stream
before it blocked. This attribute is available when using the
buffered I/O classes from the [`io`](io.html#module-io "io: Core tool... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
a5e9d5e4-090a-5f79-aec9-97964ff7b04e | docs | python | python_exceptions | 38 | 29 | *exception* `BrokenPipeError`[¶](#BrokenPipeError "Permalink to this definition")
: A subclass of [`ConnectionError`](#ConnectionError "ConnectionError"), raised when trying to write on a
pipe while the other end has been closed, or trying to write on a socket
which has been shutdown for writing.
Correspo... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
54d297b6-4faa-5a18-81f5-bcfc6686b526 | docs | python | python_exceptions | 38 | 30 | : A subclass of [`ConnectionError`](#ConnectionError "ConnectionError"), raised when a connection is
reset by the peer.
Corresponds to `errno` `ECONNRESET`.
*exception* `FileExistsError`[¶](#FileExistsError "Permalink to this definition")
: Raised when trying to create a file or directory which already exi... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
4277fa46-1503-5c10-8a19-01abb1d9a1cd | docs | python | python_exceptions | 38 | 31 | for the rationale), instead of raising [`InterruptedError`](#InterruptedError "InterruptedError").
*exception* `IsADirectoryError`[¶](#IsADirectoryError "Permalink to this definition")
: Raised when a file operation (such as [`os.remove()`](os.html#os.remove "os.remove")) is requested
on a directory.
Cor... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
69007720-a0f4-5515-8c74-7a4f29cddd2a | docs | python | python_exceptions | 38 | 32 | Corresponds to `errno` `ESRCH`.
*exception* `TimeoutError`[¶](#TimeoutError "Permalink to this definition")
: Raised when a system function timed out at the system level.
Corresponds to `errno` `ETIMEDOUT`.
New in version 3.3: All the above [`OSError`](#OSError "OSError") subclasses were added.
See also
[... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
6d3603a9-4c35-572f-a67d-28f17d42dcb0 | docs | python | python_exceptions | 38 | 33 | : Base class for warnings about deprecated features when those warnings are
intended for other Python developers.
*exception* `PendingDeprecationWarning`[¶](#PendingDeprecationWarning "Permalink to this definition")
: Base class for warnings about features which are obsolete and
expected to be deprecated i... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
7b9ae7c7-00e3-5b42-9b37-a8d4de352386 | docs | python | python_exceptions | 38 | 34 | : Base class for warnings about deprecated features when those warnings are
intended for end users of applications that are written in Python.
*exception* `ImportWarning`[¶](#ImportWarning "Permalink to this definition")
: Base class for warnings about probable mistakes in module imports.
*exception* `Unicode... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
1a854f96-a040-5530-b70c-efc3e5727d4a | docs | python | python_exceptions | 38 | 35 | ## Exception hierarchy[¶](#exception-hierarchy "Permalink to this headline")
The class hierarchy for built-in exceptions is:
```None
BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- Exception
+-- StopIteration
+-- StopAsyncIteration
+-- ArithmeticError
| +-- Floa... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
2632e469-37dd-530b-ad59-fb94dd5c7e4e | docs | python | python_exceptions | 38 | 36 | | +-- FileNotFoundError
| +-- InterruptedError
| +-- IsADirectoryError
| +-- NotADirectoryError
| +-- PermissionError
| +-- ProcessLookupError
| +-- TimeoutError
+-- ReferenceError
+-- RuntimeError
| +-- NotImplementedError
| +... | large_dataset/raw/docs/python/exceptions/exceptions_38.md |
2101df93-263b-57bc-8188-044c46c9ad0c | docs | python | python_exceptions | 39 | 0 | # Built-in Exceptions¶
Source: https://docs.python.org/3.9/library/exceptions.html
Version: 3.9
In Python, all exceptions must be instances of a class that derives from
[`BaseException`](#BaseException "BaseException"). In a [`try`](../reference/compound_stmts.html#try) statement with an [`except`](../reference/compo... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
4deb4914-cb70-5095-b8ac-ce5ad3811c32 | docs | python | python_exceptions | 39 | 1 | class’s constructor.
User code can raise built-in exceptions. This can be used to test an exception
handler or to report an error condition “just like” the situation in which the
interpreter raises the same exception; but beware that there is nothing to
prevent user code from raising an inappropriate error.
The built... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
20d506d7-9ea0-5c46-99e6-3bde78298fcf | docs | python | python_exceptions | 39 | 2 | exception. An exception may be handled when an [`except`](../reference/compound_stmts.html#except) or
[`finally`](../reference/compound_stmts.html#finally) clause, or a [`with`](../reference/compound_stmts.html#with) statement, is used.
This implicit exception context can be
supplemented with an explicit cause by usin... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
39e2da66-1518-5399-bc12-c0ca800f46f4 | docs | python | python_exceptions | 39 | 3 | The default traceback display code shows these chained exceptions in
addition to the traceback for the exception itself. An explicitly chained
exception in `__cause__` is always shown when present. An implicitly
chained exception in `__context__` is shown only if `__cause__`
is [`None`](constants.html#None "None") and ... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
99508802-679a-5388-8724-5e65cd18c866 | docs | python | python_exceptions | 39 | 4 | [Objects/exceptions.c](https://github.com/python/cpython/tree/3.9/Objects/exceptions.c). Some have custom memory layouts
which makes it impossible to create a subclass that inherits from
multiple exception types. The memory layout of a type is an implementation
detail and might change between Python versions, leading t... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
bb4f7c42-4397-526d-be95-fc4c2616c61d | docs | python | python_exceptions | 39 | 5 | there were no arguments.
`args`[¶](#BaseException.args "Permalink to this definition")
: The tuple of arguments given to the exception constructor. Some built-in
exceptions (like [`OSError`](#OSError "OSError")) expect a certain number of arguments and
assign a special meaning to the elem... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
3ca33813-047a-56e3-9f46-c0be667bb85e | docs | python | python_exceptions | 39 | 6 | : All built-in, non-system-exiting exceptions are derived from this class. All
user-defined exceptions should also be derived from this class.
*exception* `ArithmeticError`[¶](#ArithmeticError "Permalink to this definition")
: The base class for those built-in exceptions that are raised for various
arithme... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
32f4411f-4439-5b2c-bdc1-aa8b554b7c58 | docs | python | python_exceptions | 39 | 7 | can be raised directly by [`codecs.lookup()`](codecs.html#codecs.lookup "codecs.lookup").
## Concrete exceptions[¶](#concrete-exceptions "Permalink to this headline")
The following exceptions are the exceptions that are usually raised.
*exception* `AssertionError`[¶](#AssertionError "Permalink to this definition... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
a694539a-b682-569e-9fe4-4047bd47d55a | docs | python | python_exceptions | 39 | 8 | [`io.IOBase.readline()`](io.html#io.IOBase.readline "io.IOBase.readline") methods return an empty string when they hit EOF.)
*exception* `FloatingPointError`[¶](#FloatingPointError "Permalink to this definition")
: Not currently used.
*exception* `GeneratorExit`[¶](#GeneratorExit "Permalink to this definition")... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
f50a4860-d745-5f68-90b6-bd02893d0041 | docs | python | python_exceptions | 39 | 9 | load a module. Also raised when the “from list” in `from ... import`
has a name that cannot be found.
The `name` and `path` attributes can be set using keyword-only
arguments to the constructor. When set they represent the name of the module
that was attempted to be imported and the path to any fil... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
03eeee99-6e80-5945-91e8-8916c9ba8df0 | docs | python | python_exceptions | 39 | 10 | silently truncated to fall in the allowed range; if an index is not an
integer, [`TypeError`](#TypeError "TypeError") is raised.)
*exception* `KeyError`[¶](#KeyError "Permalink to this definition")
: Raised when a mapping (dictionary) key is not found in the set of existing keys.
*exception* `KeyboardInterr... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
a1cd138e-573f-54e0-8045-034bd79f57d6 | docs | python | python_exceptions | 39 | 11 | circumstances, leave the running program in an inconsistent state. It is
generally best to allow [`KeyboardInterrupt`](#KeyboardInterrupt "KeyboardInterrupt") to end the program as
quickly as possible or avoid raising it entirely. (See
[Note on Signal Handlers and Exceptions](signal.html#handlers-and-ex... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
8da5b479-575d-5263-90f6-25fd44cccb14 | docs | python | python_exceptions | 39 | 12 | : Raised when a local or global name is not found. This applies only to
unqualified names. The associated value is an error message that includes the
name that could not be found.
*exception* `NotImplementedError`[¶](#NotImplementedError "Permalink to this definition")
: This exception is derived from [`Ru... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
c7917417-e2bf-54c6-8cf8-bd3e28d37394 | docs | python | python_exceptions | 39 | 13 | [`NotImplemented`](constants.html#NotImplemented "NotImplemented") for details on when to use it.
*exception* `OSError`([*arg*])[¶](#OSError "Permalink to this definition")
*exception* `OSError`(*errno*, *strerror*[, *filename*[, *winerror*[, *filename2*]]])
: This exception is raised when a system function ret... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
3dda729a-791f-5519-9f7a-bdb57a89402a | docs | python | python_exceptions | 39 | 14 | described in [OS exceptions](#os-exceptions) below. The particular subclass depends on
the final [`errno`](#OSError.errno "OSError.errno") value. This behaviour only occurs when
constructing [`OSError`](#OSError "OSError") directly or via an alias, and is not
inherited when subclassing.
`errno`[¶](... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
59351bca-963d-5d3b-9dee-69e5bb285adf | docs | python | python_exceptions | 39 | 15 | *winerror* argument is ignored, and the [`winerror`](#OSError.winerror "OSError.winerror") attribute
does not exist.
`strerror`[¶](#OSError.strerror "Permalink to this definition")
: The corresponding error message, as provided by
the operating system. It is formatted by the C
... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
50a40606-a754-5de7-8462-4eef62130b35 | docs | python | python_exceptions | 39 | 16 | file name passed to the function.
Changed in version 3.3: [`EnvironmentError`](#EnvironmentError "EnvironmentError"), [`IOError`](#IOError "IOError"), [`WindowsError`](#WindowsError "WindowsError"),
[`socket.error`](socket.html#socket.error "socket.error"), [`select.error`](select.html#select.error "se... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
c59a7da7-7281-56a1-8d7a-dc41fcb6bb6e | docs | python | python_exceptions | 39 | 17 | [`MemoryError`](#MemoryError "MemoryError") than give up). However, for historical reasons,
OverflowError is sometimes raised for integers that are outside a required
range. Because of the lack of standardization of floating point exception
handling in C, most floating point operations are not checked.
... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
78dd1827-923b-5ecd-b872-09718186a464 | docs | python | python_exceptions | 39 | 18 | [`weakref.proxy()`](weakref.html#weakref.proxy "weakref.proxy") function, is used to access an attribute of the referent
after it has been garbage collected. For more information on weak references,
see the [`weakref`](weakref.html#module-weakref "weakref: Support for weak references and weak dictionaries."... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
d1562141-2419-56bf-a9f2-f7609b591e7e | docs | python | python_exceptions | 39 | 19 | given as an argument when constructing the exception, and defaults
to [`None`](constants.html#None "None").
When a [generator](../glossary.html#term-generator) or [coroutine](../glossary.html#term-coroutine) function
returns, a new [`StopIteration`](#StopIteration "StopIteration") instance is
raise... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
f1e83e3f-ddca-53a6-938b-269ea00f9763 | docs | python | python_exceptions | 39 | 20 | Changed in version 3.7: Enable [**PEP 479**](https://www.python.org/dev/peps/pep-0479) for all code by default: a [`StopIteration`](#StopIteration "StopIteration")
error raised in a generator is transformed into a [`RuntimeError`](#RuntimeError "RuntimeError").
*exception* `StopAsyncIteration`[¶](#StopAsyncIte... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
8501786d-40a0-58d6-b200-86ff7a8524a3 | docs | python | python_exceptions | 39 | 21 | or [`eval()`](functions.html#eval "eval"), or when reading the initial script or standard input
(also interactively).
The [`str()`](stdtypes.html#str "str") of the exception instance returns only the error message.
Details is a tuple whose members are also available as separate attributes.
`filena... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
d67c46d2-b2d8-5117-ba76-690538161b8e | docs | python | python_exceptions | 39 | 22 | For errors in f-string fields, the message is prefixed by “f-string: ”
and the offsets are offsets in a text constructed from the replacement
expression. For example, compiling f’Bad {a b} field’ results in this
args attribute: (‘f-string: …’, (‘’, 1, 4, ‘(a b)n’)).
*exception* `IndentationError`[¶](#I... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
61eec68d-a68f-59d7-b693-9f035e8b74e6 | docs | python | python_exceptions | 39 | 23 | string indicating what went wrong (in low-level terms).
You should report this to the author or maintainer of your Python interpreter.
Be sure to report the version of the Python interpreter (`sys.version`; it is
also printed at the start of an interactive Python session), the exact error
message (... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
b45246d4-1c6e-50a2-aecf-d3a6a518f505 | docs | python | python_exceptions | 39 | 24 | constructor accepts the same optional argument passed to [`sys.exit()`](sys.html#sys.exit "sys.exit").
If the value is an integer, it specifies the system exit status (passed to
C’s `exit()` function); if it is `None`, the exit status is zero; if
it has another type (such as a string), the object’s valu... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
5aa98664-6847-544b-8ef6-a56064748eec | docs | python | python_exceptions | 39 | 25 | : The exit status or error message that is passed to the constructor.
(Defaults to `None`.)
*exception* `TypeError`[¶](#TypeError "Permalink to this definition")
: Raised when an operation or function is applied to an object of inappropriate
type. The associated value is a string giving details abo... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
d7b41d74-0a3d-53d0-890f-9b7fa441c909 | docs | python | python_exceptions | 39 | 26 | should result in a [`ValueError`](#ValueError "ValueError").
*exception* `UnboundLocalError`[¶](#UnboundLocalError "Permalink to this definition")
: Raised when a reference is made to a local variable in a function or method, but
no value has been bound to that variable. This is a subclass of
[`NameError... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
911dfe86-b2b0-5dba-b1dc-ef7ad9d360e6 | docs | python | python_exceptions | 39 | 27 | : A string describing the specific codec error.
`object`[¶](#UnicodeError.object "Permalink to this definition")
: The object the codec was attempting to encode or decode.
`start`[¶](#UnicodeError.start "Permalink to this definition")
: The first index of invalid data in [`object`](functions... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
86ee54cd-0486-5487-8b04-ce9812755607 | docs | python | python_exceptions | 39 | 28 | *exception* `UnicodeTranslateError`[¶](#UnicodeTranslateError "Permalink to this definition")
: Raised when a Unicode-related error occurs during translating. It is a subclass
of [`UnicodeError`](#UnicodeError "UnicodeError").
*exception* `ValueError`[¶](#ValueError "Permalink to this definition")
: Raised whe... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
52b17842-b677-5625-b91b-4a47434fe5d2 | docs | python | python_exceptions | 39 | 29 | *exception* `EnvironmentError`[¶](#EnvironmentError "Permalink to this definition")
*exception* `IOError`[¶](#IOError "Permalink to this definition")
*exception* `WindowsError`[¶](#WindowsError "Permalink to this definition")
: Only available on Windows.
### OS exceptions[¶](#os-exceptions "Permalink to this headl... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
f98743e7-9c67-5ea2-8782-403b8cc4e449 | docs | python | python_exceptions | 39 | 30 | In addition to those of [`OSError`](#OSError "OSError"), [`BlockingIOError`](#BlockingIOError "BlockingIOError") can have
one more attribute:
`characters_written`[¶](#BlockingIOError.characters_written "Permalink to this definition")
: An integer containing the number of characters written to the str... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
42f917f5-b9b0-53f1-af63-758cb7c0825f | docs | python | python_exceptions | 39 | 31 | [`ConnectionRefusedError`](#ConnectionRefusedError "ConnectionRefusedError") and [`ConnectionResetError`](#ConnectionResetError "ConnectionResetError").
*exception* `BrokenPipeError`[¶](#BrokenPipeError "Permalink to this definition")
: A subclass of [`ConnectionError`](#ConnectionError "ConnectionError"), raise... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
a6902b82-0b2d-5c4b-b757-aaa57350bd67 | docs | python | python_exceptions | 39 | 32 | *exception* `ConnectionRefusedError`[¶](#ConnectionRefusedError "Permalink to this definition")
: A subclass of [`ConnectionError`](#ConnectionError "ConnectionError"), raised when a connection attempt
is refused by the peer.
Corresponds to `errno` [`ECONNREFUSED`](errno.html#errno.ECONNREFUSED "errno.ECONNRE... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
496b01dc-e9bc-5e7b-9cd1-ae99f4a7f9b9 | docs | python | python_exceptions | 39 | 33 | : Raised when a file or directory is requested but doesn’t exist.
Corresponds to `errno` [`ENOENT`](errno.html#errno.ENOENT "errno.ENOENT").
*exception* `InterruptedError`[¶](#InterruptedError "Permalink to this definition")
: Raised when a system call is interrupted by an incoming signal.
Corresponds to `... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
31ac791a-bb82-55f9-83e0-85595192c8a9 | docs | python | python_exceptions | 39 | 34 | *exception* `NotADirectoryError`[¶](#NotADirectoryError "Permalink to this definition")
: Raised when a directory operation (such as [`os.listdir()`](os.html#os.listdir "os.listdir")) is requested on
something which is not a directory. On most POSIX platforms, it may also be
raised if an operation attempts to... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
6db5ccd2-57d2-5cfd-99ab-91012005a6be | docs | python | python_exceptions | 39 | 35 | *exception* `TimeoutError`[¶](#TimeoutError "Permalink to this definition")
: Raised when a system function timed out at the system level.
Corresponds to `errno` [`ETIMEDOUT`](errno.html#errno.ETIMEDOUT "errno.ETIMEDOUT").
New in version 3.3: All the above [`OSError`](#OSError "OSError") subclasses were added.
... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
31f58f5c-e491-5ba4-b82d-de4eb00670ee | docs | python | python_exceptions | 39 | 36 | : Base class for warnings about deprecated features when those warnings are
intended for other Python developers.
Ignored by the default warning filters, except in the `__main__` module
([**PEP 565**](https://www.python.org/dev/peps/pep-0565)). Enabling the [Python Development Mode](devmode.html#devmode)... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
6b9e01ae-6e7c-5b0a-a81c-a116fae67f31 | docs | python | python_exceptions | 39 | 37 | Development Mode](devmode.html#devmode) shows this warning.
The deprecation policy is described in [**PEP 387**](https://www.python.org/dev/peps/pep-0387).
*exception* `SyntaxWarning`[¶](#SyntaxWarning "Permalink to this definition")
: Base class for warnings about dubious syntax.
*exception* `RuntimeWarni... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
b00dc3d5-5a8b-576b-ba7d-5b106c826a59 | docs | python | python_exceptions | 39 | 38 | : Base class for warnings related to Unicode.
*exception* `BytesWarning`[¶](#BytesWarning "Permalink to this definition")
: Base class for warnings related to [`bytes`](stdtypes.html#bytes "bytes") and [`bytearray`](stdtypes.html#bytearray "bytearray").
*exception* `ResourceWarning`[¶](#ResourceWarning "Permalink... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
41ce36ee-f05a-5d3d-bc38-c761c215e186 | docs | python | python_exceptions | 39 | 39 | +-- EOFError
+-- ImportError
| +-- ModuleNotFoundError
+-- LookupError
| +-- IndexError
| +-- KeyError
+-- MemoryError
+-- NameError
| +-- UnboundLocalError
+-- OSError
| +-- BlockingIOError
| +-- ChildProcessError
| +-- ... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
807283c5-3a42-51bf-b0e7-74d84734f7e8 | docs | python | python_exceptions | 39 | 40 | | +-- UnicodeError
| +-- UnicodeDecodeError
| +-- UnicodeEncodeError
| +-- UnicodeTranslateError
+-- Warning
+-- DeprecationWarning
+-- PendingDeprecationWarning
+-- RuntimeWarning
+-- SyntaxWarning
+-- UserW... | large_dataset/raw/docs/python/exceptions/exceptions_39.md |
2ac2ccf7-a05f-5e13-98a4-3b896e40500d | docs | python | python_stdlib2 | 310 | 0 | # 11.Brief Tour of the Standard Library — Part II¶
Source: https://docs.python.org/3.10/tutorial/stdlib2.html
Version: 3.10
This second tour covers more advanced modules that support professional
programming needs. These modules rarely occur in small scripts.
## 11.1. Output Formatting[¶](#output-formatting "Permali... | large_dataset/raw/docs/python/stdlib2/stdlib2_310.md |
a13028ad-6903-5f95-a8ff-bc6b785db216 | docs | python | python_stdlib2 | 310 | 1 | When the result is longer than one line, the “pretty printer” adds line breaks
and indentation to more clearly reveal data structure:
```None
>>> import pprint
>>> t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
... 'yellow'], 'blue']]]
...
>>> pprint.pprint(t, width=30)
[[[['black', 'cyan'],
... | large_dataset/raw/docs/python/stdlib2/stdlib2_310.md |
f787dfcf-04e1-5f72-9900-200689b3ca29 | docs | python | python_stdlib2 | 310 | 2 | The [`locale`](../library/locale.html#module-locale "locale: Internationalization services.") module accesses a database of culture specific data formats.
The grouping attribute of locale’s format function provides a direct way of
formatting numbers with group separators:
```None
>>> import locale
>>> locale.setlocale... | large_dataset/raw/docs/python/stdlib2/stdlib2_310.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.