LoginSignup
1
1

More than 5 years have passed since last update.

Python + boto3 の 'email' is not a package に対処する

Last updated at Posted at 2018-12-17

環境

  • Python 3.7.0
  • boto3 1.9.55

問題

  • Lambda 用に開発していた Python スクリプトをローカルでテストしようとしたら、 'email' is not a package というエラーメッセージが生じた。
  • Traceback をみたら冒頭の import boto3 で発生したようだった。

エラーメッセージ

Traceback (most recent call last):
  File "mail_send_test.py", line 1, in <module>
    import boto3
      :
  File "/home/ec2-user/.pyenv/versions/3.7.0/lib/python3.7/cgi.py", line 39, in <module>
    from email.parser import FeedParser
ModuleNotFoundError: No module named 'email.parser'; 'email' is not a package

原因

  • 実行スクリプトと同じディレクトリに自作の email.py があったため。

対処

  • 自作の email.py をリネームする。
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1