Y
Y
ymaruymaev2020-05-23 12:51:50
Python
ymaruymaev, 2020-05-23 12:51:50

AttributeError: partially initialized module 'http.cookiejar' has no attribute 'CookieJar' (most likely due to a circular import) How to fix?

What's my mistake?

from vk_api.longpoll import VkLongPoll, VkEventType
import vk_api
import data
from datetime import datetime

login, password = 'мой логин', 'мой пароль'
vk_session = vk_api.VkApi(login, password)
vk = vk_session.auth() 

session_api = vk_session.get_api()
longpoll = VkLongPoll(vk_session)

while True:
  for event in longpoll.listen():
    if event.type == VkEventType.MESSAGE_NEW:
      print('Текст сообщения: ' + str(event.text))

Error:

Traceback (most recent call last):
File "C:\Python\Python38-32\python\botvk7.py", line 1, in
from vk_api.longpoll import VkLongPoll, VkEventType
File "C:\Users\rinat\AppData \Local\Programs\Python\Python38-32\lib\site-packages\vk_api\__init__.py", line 10, in
from .requests_pool import VkRequestsPool, vk_request_one_param_pool
File "C:\Users\rinat\AppData\Local\Programs\ Python\Python38-32\lib\site-packages\vk_api\requests_pool.py", line 14, in
from .execute import VkFunction
File "C:\Users\rinat\AppData\Local\Programs\Python\Python38-32\lib \site-packages\vk_api\execute.py", line 11, in
from .utils import sjson_dumps
File "C:\Users\rinat\AppData\Local\Programs\Python\Python38-32\lib\site-packages\vk_api\utils.py", line 21, in
from http.cookiejar import Cookie
File "C:\Users \rinat\AppData\Local\Programs\Python\Python38-32\lib\http\cookiejar.py", line 32, in
import copy
File "C:\Python\Python38-32\python\copy.py", line 1 , in
from vk_api.longpoll import VkLongPoll, VkEventType
File "C:\Users\rinat\AppData\Local\Programs\Python\Python38-32\lib\site-packages\vk_api\longpoll.py", line 13, in
import requests
File "C:\Users\rinat\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\__init__.py", line 112, in
from . import utilities
File "C:\Users\rinat\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\utils.py", line 33, in
from .cookies import cookiejar_from_dict
File "C:\Users\ rinat\AppData\Local\Programs\Python\Python38-32\lib\site-packages\requests\cookies.py", line 171, in
class RequestsCookieJar(cookielib.CookieJar, MutableMapping):
AttributeError: partially initialized module 'http.cookiejar ' has no attribute 'CookieJar' (most likely due to a circular import)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question