| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | .. currentmodule:: asyncio
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-14 15:11:24 -07:00
										 |  |  | .. _asyncio-exceptions:
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | ==========
 | 
					
						
							|  |  |  | Exceptions
 | 
					
						
							|  |  |  | ==========
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-10 19:18:46 -04:00
										 |  |  | **Source code:** :source:`Lib/asyncio/exceptions.py`
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ----------------------------------------------------
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | .. exception:: TimeoutError
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-19 16:52:40 +05:30
										 |  |  |    A deprecated alias of :exc:`TimeoutError`,
 | 
					
						
							|  |  |  |    raised when the operation has exceeded the given deadline.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-12-19 16:52:40 +05:30
										 |  |  |    .. versionchanged:: 3.11
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       This class was made an alias of :exc:`TimeoutError`.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. exception:: CancelledError
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    The operation has been cancelled.
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-13 16:14:41 -07:00
										 |  |  |    This exception can be caught to perform custom operations
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  |    when asyncio Tasks are cancelled.  In almost all situations the
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |    exception must be re-raised.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 15:12:51 +01:00
										 |  |  |    .. versionchanged:: 3.8
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-07-05 15:07:02 +00:00
										 |  |  |       :exc:`CancelledError` is now a subclass of :class:`BaseException` rather than :class:`Exception`.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. exception:: InvalidStateError
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    Invalid internal state of :class:`Task` or :class:`Future`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    Can be raised in situations like setting a result value for a
 | 
					
						
							|  |  |  |    *Future* object that already has a result value set.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. exception:: SendfileNotAvailableError
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-13 16:14:41 -07:00
										 |  |  |    The "sendfile" syscall is not available for the given
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  |    socket or file type.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |    A subclass of :exc:`RuntimeError`.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. exception:: IncompleteReadError
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 08:02:17 -03:00
										 |  |  |    The requested read operation did not complete fully.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 08:02:17 -03:00
										 |  |  |    Raised by the :ref:`asyncio stream APIs<asyncio-streams>`.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 08:02:17 -03:00
										 |  |  |    This exception is a subclass of :exc:`EOFError`.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |    .. attribute:: expected
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |       The total number (:class:`int`) of expected bytes.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |    .. attribute:: partial
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |       A string of :class:`bytes` read before the end of stream was reached.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .. exception:: LimitOverrunError
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |    Reached the buffer size limit while looking for a separator.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |    Raised by the :ref:`asyncio stream APIs <asyncio-streams>`.
 | 
					
						
							| 
									
										
										
										
											2018-09-11 09:54:40 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |    .. attribute:: consumed
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-17 19:16:44 -04:00
										 |  |  |       The total number of to be consumed bytes.
 |