Skip to content

AttributeError in "iter_attachments" on "is_attachment" call #124936

@sgeulette

Description

@sgeulette

Bug report

Bug description:

Hello,
Using Python 3.10.15, I have an error calling "iter_attachments()" on an "email.message.EmailMessage" object.
The email is produced by a multifunction printer. It is well opened in thunderbird.
Error is the following:

  File "/home/user/.pyenv/versions/3.10.15/lib/python3.10/email/message.py", line 1080, in iter_attachments
    not part.is_attachment() and subtype not in seen):
AttributeError: 'MIMEText' object has no attribute 'is_attachment'

The problematic part (part.as_string()) is the following :
Content-Type: text/html; charset="us-ascii"\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\n\n<html><body><p></p></body></html>
I have from time to time the same problem with other emails (not only email from scanner).

Regards

An example of a problematic email is zipped...[
error_is_attachment.zip
](url)

CPython versions tested on:

3.10

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions