@Foxik1

Почему ошибка Pymongo?

Ошибка PyMongo
Код:
import pymongo

client = pymongo.MongoClient("mongodb+srv://foksik:пароль@mflix-m5hjq.mongodb.net/?retryWrites=true")
db = client.test
collection = db['testcoll']
name = input('> ')
collection.insert_one({'_id': 1, 'name': name, 'balance': 100})


Ошибки:
Exception in thread Thread-1:
Traceback (most recent call last):
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\dns\win32util.py", line 48, in run
    self.info.domain = _config_domain(interface.DNSDomain)
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\dns\win32util.py", line 26, in _config_domain
    if domain.startswith('.'):
AttributeError: 'NoneType' object has no attribute 'startswith'

Traceback (most recent call last):
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\srv_resolver.py", line 90, in _resolve_uri
    "_" + self.__srv + "._tcp." + self.__fqdn, "SRV", lifetime=self.__connect_timeout
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\srv_resolver.py", line 43, in _resolve
    return resolver.resolve(*args, **kwargs)
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\dns\resolver.py", line 1195, in resolve
    lifetime, search)
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\dns\resolver.py", line 1063, in resolve
    (nameserver, port, tcp, backoff) = resolution.next_nameserver()
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\dns\resolver.py", line 646, in next_nameserver
    raise NoNameservers(request=self.request, errors=self.errors)
dns.resolver.NoNameservers: All nameservers failed to answer the query _mongodb._tcp.mflix-m5hjq.mongodb.net. IN SRV: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/1/PycharmProjects/pythonProject1/Скорость интернета/Script.py", line 3, in <module>
    client = pymongo.MongoClient("mongodb+srv://foksik:пароль@mflix-m5hjq.mongodb.net/?retryWrites=true")
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\mongo_client.py", line 712, in __init__
    srv_max_hosts=srv_max_hosts,
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\uri_parser.py", line 542, in parse_uri
    nodes = dns_resolver.get_hosts()
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\srv_resolver.py", line 121, in get_hosts
    _, nodes = self._get_srv_response_and_hosts(True)
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\srv_resolver.py", line 101, in _get_srv_response_and_hosts
    results = self._resolve_uri(encapsulate_errors)
  File "D:\Users\1\AppData\Local\Programs\Python\Python37\lib\site-packages\pymongo\srv_resolver.py", line 97, in _resolve_uri
    raise ConfigurationError(str(exc))
pymongo.errors.ConfigurationError: All nameservers failed to answer the query _mongodb._tcp.mflix-m5hjq.mongodb.net. IN SRV:
  • Вопрос задан
  • 108 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы