Mr.Combet Webshell
Your IP :
216.73.216.136
Server IP :
103.233.58.157
Server :
Windows NT WIN-4PGF72KEHKB 10.0 build 17763 (Windows Server 2016) AMD64
Server Software :
Microsoft-IIS/10.0
PHP Version :
7.3.25
Add File :
Submit
Add Directory :
Submit
Dir :
C:
/
Program Files
/
Python312
/
Doc
/
html
/
library
/
Edit File Name :
email.errors.html
<!DOCTYPE html> <html lang="en" data-content_root="../"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" /> <meta property="og:title" content="email.errors: Exception and Defect classes" /> <meta property="og:type" content="website" /> <meta property="og:url" content="https://docs.python.org/3/library/email.errors.html" /> <meta property="og:site_name" content="Python documentation" /> <meta property="og:description" content="Source code: Lib/email/errors.py The following exception classes are defined in the email.errors module: Here is the list of the defects that the FeedParser can find while parsing messages. Note th..." /> <meta property="og:image" content="https://docs.python.org/3/_static/og-image.png" /> <meta property="og:image:alt" content="Python documentation" /> <meta name="description" content="Source code: Lib/email/errors.py The following exception classes are defined in the email.errors module: Here is the list of the defects that the FeedParser can find while parsing messages. Note th..." /> <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" /> <meta name="theme-color" content="#3776ab" /> <title>email.errors: Exception and Defect classes — Python 3.12.3 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=80d5e7a1" /> <link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?v=bb723527" /> <link id="pygments_dark_css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css" href="../_static/pygments_dark.css?v=b20cc3f5" /> <script src="../_static/documentation_options.js?v=2c828074"></script> <script src="../_static/doctools.js?v=888ff710"></script> <script src="../_static/sphinx_highlight.js?v=dc90522c"></script> <script src="../_static/sidebar.js"></script> <link rel="search" type="application/opensearchdescription+xml" title="Search within Python 3.12.3 documentation" href="../_static/opensearch.xml"/> <link rel="author" title="About these documents" href="../about.html" /> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="copyright" title="Copyright" href="../copyright.html" /> <link rel="next" title="email.headerregistry: Custom Header Objects" href="email.headerregistry.html" /> <link rel="prev" title="email.policy: Policy Objects" href="email.policy.html" /> <link rel="canonical" href="https://docs.python.org/3/library/email.errors.html" /> <style> @media only screen { table.full-width-table { width: 100%; } } </style> <link rel="stylesheet" href="../_static/pydoctheme_dark.css" media="(prefers-color-scheme: dark)" id="pydoctheme_dark_css"> <link rel="shortcut icon" type="image/png" href="../_static/py.svg" /> <script type="text/javascript" src="../_static/copybutton.js"></script> <script type="text/javascript" src="../_static/menu.js"></script> <script type="text/javascript" src="../_static/search-focus.js"></script> <script type="text/javascript" src="../_static/themetoggle.js"></script> </head> <body> <div class="mobile-nav"> <input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation" aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" /> <nav class="nav-content" role="navigation"> <label for="menuToggler" class="toggler__label"> <span></span> </label> <span class="nav-items-wrapper"> <a href="https://www.python.org/" class="nav-logo"> <img src="../_static/py.svg" alt="Python logo"/> </a> <span class="version_switcher_placeholder"></span> <form role="search" class="search" action="../search.html" method="get"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon"> <path fill-rule="nonzero" fill="currentColor" d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path> </svg> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" /> <input type="submit" value="Go"/> </form> </span> </nav> <div class="menu-wrapper"> <nav class="menu" role="navigation" aria-label="main navigation"> <div class="language_switcher_placeholder"></div> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> <div> <h4>Previous topic</h4> <p class="topless"><a href="email.policy.html" title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.policy</span></code>: Policy Objects</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="email.headerregistry.html" title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.headerregistry</span></code>: Custom Header Objects</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li> <a href="https://github.com/python/cpython/blob/main/Doc/library/email.errors.rst" rel="nofollow">Show Source </a> </li> </ul> </div> </nav> </div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="email.headerregistry.html" title="email.headerregistry: Custom Header Objects" accesskey="N">next</a> |</li> <li class="right" > <a href="email.policy.html" title="email.policy: Policy Objects" accesskey="P">previous</a> |</li> <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li class="switchers"> <div class="language_switcher_placeholder"></div> <div class="version_switcher_placeholder"></div> </li> <li> </li> <li id="cpython-language-and-version"> <a href="../index.html">3.12.3 Documentation</a> » </li> <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li> <li class="nav-item nav-item-2"><a href="netdata.html" >Internet Data Handling</a> »</li> <li class="nav-item nav-item-3"><a href="email.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code> — An email and MIME handling package</a> »</li> <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.errors</span></code>: Exception and Defect classes</a></li> <li class="right"> <div class="inline-search" role="search"> <form class="inline-search" action="../search.html" method="get"> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" /> <input type="submit" value="Go" /> </form> </div> | </li> <li class="right"> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> |</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <section id="module-email.errors"> <span id="email-errors-exception-and-defect-classes"></span><h1><a class="reference internal" href="#module-email.errors" title="email.errors: The exception classes used by the email package."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.errors</span></code></a>: Exception and Defect classes<a class="headerlink" href="#module-email.errors" title="Link to this heading">¶</a></h1> <p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/3.12/Lib/email/errors.py">Lib/email/errors.py</a></p> <hr class="docutils" /> <p>The following exception classes are defined in the <a class="reference internal" href="#module-email.errors" title="email.errors: The exception classes used by the email package."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.errors</span></code></a> module:</p> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageError"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">MessageError</span></span><a class="headerlink" href="#email.errors.MessageError" title="Link to this definition">¶</a></dt> <dd><p>This is the base class for all exceptions that the <a class="reference internal" href="email.html#module-email" title="email: Package supporting the parsing, manipulating, and generating email messages."><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code></a> package can raise. It is derived from the standard <a class="reference internal" href="exceptions.html#Exception" title="Exception"><code class="xref py py-exc docutils literal notranslate"><span class="pre">Exception</span></code></a> class and defines no additional methods.</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageParseError"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">MessageParseError</span></span><a class="headerlink" href="#email.errors.MessageParseError" title="Link to this definition">¶</a></dt> <dd><p>This is the base class for exceptions raised by the <a class="reference internal" href="email.parser.html#email.parser.Parser" title="email.parser.Parser"><code class="xref py py-class docutils literal notranslate"><span class="pre">Parser</span></code></a> class. It is derived from <a class="reference internal" href="#email.errors.MessageError" title="email.errors.MessageError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageError</span></code></a>. This class is also used internally by the parser used by <a class="reference internal" href="email.headerregistry.html#module-email.headerregistry" title="email.headerregistry: Automatic Parsing of headers based on the field name"><code class="xref py py-mod docutils literal notranslate"><span class="pre">headerregistry</span></code></a>.</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.HeaderParseError"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">HeaderParseError</span></span><a class="headerlink" href="#email.errors.HeaderParseError" title="Link to this definition">¶</a></dt> <dd><p>Raised under some error conditions when parsing the <span class="target" id="index-0"></span><a class="rfc reference external" href="https://datatracker.ietf.org/doc/html/rfc5322.html"><strong>RFC 5322</strong></a> headers of a message, this class is derived from <a class="reference internal" href="#email.errors.MessageParseError" title="email.errors.MessageParseError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageParseError</span></code></a>. The <a class="reference internal" href="email.message.html#email.message.EmailMessage.set_boundary" title="email.message.EmailMessage.set_boundary"><code class="xref py py-meth docutils literal notranslate"><span class="pre">set_boundary()</span></code></a> method will raise this error if the content type is unknown when the method is called. <a class="reference internal" href="email.header.html#email.header.Header" title="email.header.Header"><code class="xref py py-class docutils literal notranslate"><span class="pre">Header</span></code></a> may raise this error for certain base64 decoding errors, and when an attempt is made to create a header that appears to contain an embedded header (that is, there is what is supposed to be a continuation line that has no leading whitespace and looks like a header).</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.BoundaryError"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">BoundaryError</span></span><a class="headerlink" href="#email.errors.BoundaryError" title="Link to this definition">¶</a></dt> <dd><p>Deprecated and no longer used.</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MultipartConversionError"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">MultipartConversionError</span></span><a class="headerlink" href="#email.errors.MultipartConversionError" title="Link to this definition">¶</a></dt> <dd><p>Raised when a payload is added to a <a class="reference internal" href="email.compat32-message.html#email.message.Message" title="email.message.Message"><code class="xref py py-class docutils literal notranslate"><span class="pre">Message</span></code></a> object using <code class="xref py py-meth docutils literal notranslate"><span class="pre">add_payload()</span></code>, but the payload is already a scalar and the message’s <em class="mailheader">Content-Type</em> main type is not either <em class="mimetype">multipart</em> or missing. <a class="reference internal" href="#email.errors.MultipartConversionError" title="email.errors.MultipartConversionError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MultipartConversionError</span></code></a> multiply inherits from <a class="reference internal" href="#email.errors.MessageError" title="email.errors.MessageError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageError</span></code></a> and the built-in <a class="reference internal" href="exceptions.html#TypeError" title="TypeError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">TypeError</span></code></a>.</p> <p>Since <code class="xref py py-meth docutils literal notranslate"><span class="pre">Message.add_payload()</span></code> is deprecated, this exception is rarely raised in practice. However the exception may also be raised if the <a class="reference internal" href="email.compat32-message.html#email.message.Message.attach" title="email.message.Message.attach"><code class="xref py py-meth docutils literal notranslate"><span class="pre">attach()</span></code></a> method is called on an instance of a class derived from <a class="reference internal" href="email.mime.html#email.mime.nonmultipart.MIMENonMultipart" title="email.mime.nonmultipart.MIMENonMultipart"><code class="xref py py-class docutils literal notranslate"><span class="pre">MIMENonMultipart</span></code></a> (e.g. <a class="reference internal" href="email.mime.html#email.mime.image.MIMEImage" title="email.mime.image.MIMEImage"><code class="xref py py-class docutils literal notranslate"><span class="pre">MIMEImage</span></code></a>).</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.MessageDefect"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">MessageDefect</span></span><a class="headerlink" href="#email.errors.MessageDefect" title="Link to this definition">¶</a></dt> <dd><p>This is the base class for all defects found when parsing email messages. It is derived from <a class="reference internal" href="exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a>.</p> </dd></dl> <dl class="py exception"> <dt class="sig sig-object py" id="email.errors.HeaderDefect"> <em class="property"><span class="pre">exception</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">email.errors.</span></span><span class="sig-name descname"><span class="pre">HeaderDefect</span></span><a class="headerlink" href="#email.errors.HeaderDefect" title="Link to this definition">¶</a></dt> <dd><p>This is the base class for all defects found when parsing email headers. It is derived from <a class="reference internal" href="#email.errors.MessageDefect" title="email.errors.MessageDefect"><code class="xref py py-exc docutils literal notranslate"><span class="pre">MessageDefect</span></code></a>.</p> </dd></dl> <p>Here is the list of the defects that the <a class="reference internal" href="email.parser.html#email.parser.FeedParser" title="email.parser.FeedParser"><code class="xref py py-class docutils literal notranslate"><span class="pre">FeedParser</span></code></a> can find while parsing messages. Note that the defects are added to the message where the problem was found, so for example, if a message nested inside a <em class="mimetype">multipart/alternative</em> had a malformed header, that nested message object would have a defect, but the containing messages would not.</p> <p>All defect classes are subclassed from <a class="reference internal" href="#email.errors.MessageDefect" title="email.errors.MessageDefect"><code class="xref py py-class docutils literal notranslate"><span class="pre">email.errors.MessageDefect</span></code></a>.</p> <ul> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">NoBoundaryInMultipartDefect</span></code> – A message claimed to be a multipart, but had no <em class="mimetype">boundary</em> parameter.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">StartBoundaryNotFoundDefect</span></code> – The start boundary claimed in the <em class="mailheader">Content-Type</em> header was never found.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">CloseBoundaryNotFoundDefect</span></code> – A start boundary was found, but no corresponding close boundary was ever found.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.3.</span></p> </div> </li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">FirstHeaderLineIsContinuationDefect</span></code> – The message had a continuation line as its first header line.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MisplacedEnvelopeHeaderDefect</span></code> - A “Unix From” header was found in the middle of a header block.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MissingHeaderBodySeparatorDefect</span></code> - A line was found while parsing headers that had no leading white space but contained no ‘:’. Parsing continues assuming that the line represents the first line of the body.</p> <div class="versionadded"> <p><span class="versionmodified added">New in version 3.3.</span></p> </div> </li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MalformedHeaderDefect</span></code> – A header was found that was missing a colon, or was otherwise malformed.</p> <div class="deprecated"> <p><span class="versionmodified deprecated">Deprecated since version 3.3: </span>This defect has not been used for several Python versions.</p> </div> </li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">MultipartInvariantViolationDefect</span></code> – A message claimed to be a <em class="mimetype">multipart</em>, but no subparts were found. Note that when a message has this defect, its <a class="reference internal" href="email.compat32-message.html#email.message.Message.is_multipart" title="email.message.Message.is_multipart"><code class="xref py py-meth docutils literal notranslate"><span class="pre">is_multipart()</span></code></a> method may return <code class="docutils literal notranslate"><span class="pre">False</span></code> even though its content type claims to be <em class="mimetype">multipart</em>.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidBase64PaddingDefect</span></code> – When decoding a block of base64 encoded bytes, the padding was not correct. Enough padding is added to perform the decode, but the resulting decoded bytes may be invalid.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidBase64CharactersDefect</span></code> – When decoding a block of base64 encoded bytes, characters outside the base64 alphabet were encountered. The characters are ignored, but the resulting decoded bytes may be invalid.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidBase64LengthDefect</span></code> – When decoding a block of base64 encoded bytes, the number of non-padding base64 characters was invalid (1 more than a multiple of 4). The encoded block was kept as-is.</p></li> <li><p><code class="xref py py-class docutils literal notranslate"><span class="pre">InvalidDateDefect</span></code> – When decoding an invalid or unparsable date field. The original value is kept as-is.</p></li> </ul> </section> <div class="clearer"></div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <div> <h4>Previous topic</h4> <p class="topless"><a href="email.policy.html" title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.policy</span></code>: Policy Objects</a></p> </div> <div> <h4>Next topic</h4> <p class="topless"><a href="email.headerregistry.html" title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.headerregistry</span></code>: Custom Header Objects</a></p> </div> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../bugs.html">Report a Bug</a></li> <li> <a href="https://github.com/python/cpython/blob/main/Doc/library/email.errors.rst" rel="nofollow">Show Source </a> </li> </ul> </div> </div> <div id="sidebarbutton" title="Collapse sidebar"> <span>«</span> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="../py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="email.headerregistry.html" title="email.headerregistry: Custom Header Objects" >next</a> |</li> <li class="right" > <a href="email.policy.html" title="email.policy: Policy Objects" >previous</a> |</li> <li><img src="../_static/py.svg" alt="Python logo" style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="https://www.python.org/">Python</a> »</li> <li class="switchers"> <div class="language_switcher_placeholder"></div> <div class="version_switcher_placeholder"></div> </li> <li> </li> <li id="cpython-language-and-version"> <a href="../index.html">3.12.3 Documentation</a> » </li> <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li> <li class="nav-item nav-item-2"><a href="netdata.html" >Internet Data Handling</a> »</li> <li class="nav-item nav-item-3"><a href="email.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">email</span></code> — An email and MIME handling package</a> »</li> <li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">email.errors</span></code>: Exception and Defect classes</a></li> <li class="right"> <div class="inline-search" role="search"> <form class="inline-search" action="../search.html" method="get"> <input placeholder="Quick search" aria-label="Quick search" type="search" name="q" id="search-box" /> <input type="submit" value="Go" /> </form> </div> | </li> <li class="right"> <label class="theme-selector-label"> Theme <select class="theme-selector" oninput="activateTheme(this.value)"> <option value="auto" selected>Auto</option> <option value="light">Light</option> <option value="dark">Dark</option> </select> </label> |</li> </ul> </div> <div class="footer"> © <a href="../copyright.html"> Copyright </a> 2001-2024, Python Software Foundation. <br /> This page is licensed under the Python Software Foundation License Version 2. <br /> Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License. <br /> See <a href="/license.html">History and License</a> for more information.<br /> <br /> The Python Software Foundation is a non-profit corporation. <a href="https://www.python.org/psf/donations/">Please donate.</a> <br /> <br /> Last updated on Apr 09, 2024 (13:47 UTC). <a href="/bugs.html">Found a bug</a>? <br /> Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 7.2.6. </div> </body> </html>
Save