Ticket: Connection - User info error on Windows 10

Hello,

I get this error when running the connection test on Windows 10. The environment and the uri seems to be OK, but the movies.py script seems to have an error. Is this possible?

(mflix) c:\mongodb\m220p\mflix-python>python run.py
Traceback (most recent call last):
File “run.py”, line 1, in
from mflix.factory import create_app
File “c:\mongodb\m220p\mflix-python\mflix\factory.py”, line 12, in
from mflix.api.movies import movies_api_v1
File “c:\mongodb\m220p\mflix-python\mflix\api\movies.py”, line 225
**user_info
^
SyntaxError: invalid syntax

(mflix) c:\mongodb\m220p\mflix-python>pytest -m connection
ImportError while loading conftest ‘c:\mongodb\m220p\mflix-python\tests\conftest.py’.
c:\python27\lib\site-packages\six.py:709: in exec_
exec(""“exec code in globs, locs”"")
tests\conftest.py:2: in
from mflix.factory import create_app
mflix\factory.py:12: in
from mflix.api.movies import movies_api_v1
E File “c:\mongodb\m220p\mflix-python\mflix\api\movies.py”, line 225
E **user_info
E ^
E SyntaxError: invalid syntax

(mflix) c:\mongodb\m220p\mflix-python>

What can I do? Thanks in advance!

The URI is probably wrong. Please share it so that we can see.

Ticket: Connection

With this URI I can connect correctly from the shell using the mongo command:

[PROD]
SECRET_KEY = my_key
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-is0qb.mongodb.net/test

[TEST]
SECRET_KEY = another_key
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-is0qb.mongodb.net/test

Thank you!

Humm…

I have changed my .ini to use your cluster and I could run pytest -m connection successfully.

So your URI is definitively correct.

As a linux user I will say the problem is Windows. Sorry I cannot help.

1 Like

which version of python and pip are you using?
I also had a similar problem, updated both python and pip and then reinstalled the requirements.
Now it is working fine

2 Likes

I’m afraid it was using Python 2.7, which was also installed on my computer. I uninstalled it, reinstalled the latest Conda and the Connection Test finally worked.

So, the problem was the Python version.

Thank you!!!

1 Like

Hello,
This problem is related with one configuration on the db.py, the function spects 2 args and receives just one.
Is you are in the begin, just comment the line:

‘wtimeout’: w_concern._WriteConcern__document.get(‘wtimeout’, ‘0’),**user_info

But, remember, uncomment this line when arrived on the chapter 4.

Regards.
F