ImportError: No module named mime.multipart

后端 未结 5 1247
醉酒成梦
醉酒成梦 2021-02-05 13:44

Good morning,

For testing purposes, I have made a one-line Python program:

from email.mime.multipart import MIMEMultipart

When I run it

5条回答
  •  半阙折子戏
    2021-02-05 14:12

    An easier way to debug the error is:

    >>> import email
    >>> dir(email)
    ['Charset', 'Encoders', 'Errors', 'FeedParser', 'Generator', 'Header', 'Iterator
    s', 'LazyImporter', 'MIMEAudio', 'MIMEBase', 'MIMEImage', 'MIMEMessage', 'MIMEMu
    ltipart', 'MIMENonMultipart', 'MIMEText', 'Message', 'Parser', 'Utils', '_LOWERN
    AMES', '_MIMENAMES', '__all__', '__builtins__', '__doc__', '__file__', '__name__
    ', '__package__', '__path__', '__version__', '_name', 'base64MIME', 'email', 'im
    porter', 'message_from_file', 'message_from_string', 'mime', 'quopriMIME', 'sys'
    ]
    >>>
    

    from the above you can note that MIMEMultipart is readily available to be imported from email.

提交回复
热议问题