ImportError: cannot import name 'Policy'
Closed this issue · 2 comments
I suddenly get the error from the title. Uninstalled and installed Pynder and started a new file with one of the Pynder examples - the error remains.
The following line causes the error, if I remove Policy there is the same error with compat32. All other imports work fine.
from email._policybase import Policy, compat32
This is the full Stacktrace:
Traceback (most recent call last): File "C:/Users/Paul/PycharmProjects/Tinderella/TinderBot.py", line 1, in <module> import pynder File "C:\Users\Paul\Anaconda3\lib\site-packages\pynder\__init__.py", line 1, in <module> from pynder.session import Session # NOQA File "C:\Users\Paul\Anaconda3\lib\site-packages\pynder\session.py", line 4, in <module> import pynder.api as api File "C:\Users\Paul\Anaconda3\lib\site-packages\pynder\api.py", line 1, in <module> import requests File "C:\Users\Paul\Anaconda3\lib\site-packages\requests\__init__.py", line 43, in <module> import urllib3 File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\__init__.py", line 8, in <module> from .connectionpool import ( File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 11, in <module> from .exceptions import ( File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\exceptions.py", line 2, in <module> from .packages.six.moves.http_client import ( File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\packages\six.py", line 203, in load_module mod = mod._resolve() File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\packages\six.py", line 115, in _resolve return _import_module(self.mod) File "C:\Users\Paul\Anaconda3\lib\site-packages\urllib3\packages\six.py", line 82, in _import_module __import__(name) File "C:\Users\Paul\Anaconda3\lib\http\client.py", line 71, in <module> import email.parser File "C:\Users\Paul\Anaconda3\lib\email\parser.py", line 12, in <module> from email.feedparser import FeedParser, BytesFeedParser File "C:\Users\Paul\Anaconda3\lib\email\feedparser.py", line 27, in <module> from email._policybase import compat32 File "C:\Users\Paul\Anaconda3\lib\email\_policybase.py", line 9, in <module> from email.utils import _has_surrogates File "C:\Users\Paul\Anaconda3\lib\email\utils.py", line 33, in <module> from email._parseaddr import quote File "C:\Users\Paul\Anaconda3\lib\email\_parseaddr.py", line 16, in <module> import time, calendar File "C:\Users\Paul\PycharmProjects\Tinderella\calendar.py", line 2, in <module> import httplib2 File "C:\Users\Paul\Anaconda3\lib\site-packages\httplib2\__init__.py", line 33, in <module> import email.message File "C:\Users\Paul\Anaconda3\lib\email\message.py", line 17, in <module> from email._policybase import Policy, compat32 ImportError: cannot import name 'Policy'
EDIT:
I called a file calendar.py which caused a conflict.
THANK YOU @PaulAhuevo, I also ran into this by naming my project calendar
!
had exactly the same issue, but when trying to consume google calendar API. Insane! But thank you for the hint!