python / cpython

The Python programming language
https://www.python.org
Other
63.2k stars 30.26k forks source link

ImportError: cannot import name '_header_value_parser' from 'email' #100706

Open minyoung90 opened 1 year ago

minyoung90 commented 1 year ago
....
File "/usr/local/lib/python3.9/site-packages/fastapi_mail/fastmail.py", line 7, in <module>
from fastapi_mail.connection import Connection
File "/usr/local/lib/python3.9/site-packages/fastapi_mail/connection.py", line 1, in <module>
import aiosmtplib
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/__init__.py", line 12, in <module>
from .api import send
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/api.py", line 12, in <module>
from .smtp import SMTP
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/smtp.py", line 14, in <module>
from .auth import SMTPAuth
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/auth.py", line 10, in <module>
from .esmtp import ESMTP
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/esmtp.py", line 10, in <module>
from .email import parse_address, quote_address
File "/usr/local/lib/python3.9/site-packages/aiosmtplib/email.py", line 8, in <module>
import email.headerregistry
File "/usr/local/lib/python3.9/email/headerregistry.py", line 14, in <module>
from email import _header_value_parser as parser
ImportError: cannot import name '_header_value_parser' from 'email' (/usr/local/lib/python3.9/email/__init__.py)

I have a production level system, and I got this error suddenly. is it wrong depenency with python 3.9?

I am using "tiangolo/uvicorn-gunicorn-fastapi:python3.9-slim" for python docker image.

stevendaprano commented 1 year ago

If you "got this error suddenly", what changed immediately before the error occurred?

minyoung90 commented 1 year ago

If you "got this error suddenly", what changed immediately before the error occurred?

Actually there were no changes. I got this error first time on my service. this service played well for about 5 months until this time.

ericvsmith commented 1 year ago

When you say "my service", is this a hosted email service? If so, you should talk to the hoster.

minyoung90 commented 1 year ago

I am sorry I don't understand, so it is not about "python3.9/email/headerregistry.py" and problem is that the library what I am using or hosted server environment?

ericvsmith commented 1 year ago

I don’t know. I’m just trying to get more information about your environment. If this used to work but now doesn’t, you need to tell us what changed. Or maybe ask the person who created the docker image.