install pymongo in fresh python environment (do not install dnspython)
try to initialize a MongoClient using a mongodb+srv url
(pymongo-test) ***@*******:~# python
Python 3.8.12 (default, Dec 22 2021, 16:14:18)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>> pymongo._version_
'4.1.0'
>>> url = "mongodb+srv://*****/test?retryWrites=true"
>>> client = pymongo.MongoClient(url)
Traceback (most recent call last):
{{ File "<stdin>", line 1, in <module>}}
{{ File "/root/.pyenv/versions/pymongo-test/lib/python3.8/site-packages/pymongo/mongo_client.py", line 704, in _init_}}
{{ res = uri_parser.parse_uri(}}
{{ File "/root/.pyenv/versions/pymongo-test/lib/python3.8/site-packages/pymongo/uri_parser.py", line 467, in parse_uri}}
{{ python_path = sys.executable or "python"}}
NameError: name 'sys' is not defined
if dnspython is installed, this code isn't executed, so no problems there.
- is caused by
-
PYTHON-3120 Set up flake8 linting
- Closed