selfteaching / selfteaching/selfteaching-python-camp

Day11 发送邮件时报错 UnicodeDecodeError

Open
#1,425 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
151
Forks
875
PR merge metrics
No merged PRs in 30d

Description

一开始我以为是我写的程序有问题,后来尝试执行了前一期其他班同学的作业,发现返回的结果都是这个,我猜想是不是系统方面的问题,求大神帮忙解答。跪谢!

错误代码如下:

Traceback (most recent call last):
  File "day11_training1.py", line 32, in <module>
    yag.send(recipients,'19100205 ss412231878',wechat_word)
  File "C:\Users\33\Anaconda3\lib\site-packages\yagmail\sender.py", line 144, in send
    self.login()
  File "C:\Users\33\Anaconda3\lib\site-packages\yagmail\sender.py", line 243, in login
    self._login(self.credentials)
  File "C:\Users\33\Anaconda3\lib\site-packages\yagmail\sender.py", line 189, in _login
    self.smtp = self.connection(self.host, self.port, **self.kwargs)
  File "C:\Users\33\Anaconda3\lib\smtplib.py", line 1031, in __init__
    source_address)
  File "C:\Users\33\Anaconda3\lib\smtplib.py", line 261, in __init__
    fqdn = socket.getfqdn()
  File "C:\Users\33\Anaconda3\lib\socket.py", line 676, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 2: invalid continuation byte

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with day11_training1.py and reproduce the traceback at yagmail.send, then inspect the Python smtplib and socket.getfqdn calls shown in the stack trace. Compare the failing environment with the other reported executions and document the confirmed cause and resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.