2
votes

The IDE pyCharm thinks "MIMEMultipart" is an unresolved reference:

from email.MIMEMultipart import MIMEMultipart

The is a red warning on the right hand side bar.

Up to now every red warning on this side bar was correct and broken code. But here the code works.

What's wrong here: my usage of MIMEMultipart or pyCharm?

1
Do you use any virtualenv which is unknown to pycharm? Do you run your script using pycharm or in some other way? Which python version? - tjati
ctrl-click on email and take a look at the source of this module. email uses a somewhat fancy dynamic import mechanism that PyCharm just can't follow. - sebastian

1 Answers

4
votes

you must write in this way:

from email.mime.multipart import MIMEMultipart