Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mloginfo "SyntaxError: invalid syntax even with python3.6 installed on the machine #778

Closed
Simone-cogno opened this issue Jan 27, 2020 · 1 comment

Comments

@Simone-cogno
Copy link

Simone-cogno commented Jan 27, 2020

I reopened the issues because seems like my problem described in the closed ticket #777 was not well understood.

I try to use mloginfo but it fails to lunch because of a sytax error.

Expected behavior

mloginfo should work, and not having syntax errors.

Actual/current behavior

mloginfo /usr/local/var/mongodb/info.log --queries Traceback (most recent call last): File "/usr/local/bin/mloginfo", line 9, in <module> load_entry_point('mtools==1.6.1', 'console_scripts', 'mloginfo')() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 565, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2697, in load_entry_point return ep.load() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2370, in load return self.resolve() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2376, in resolve module = __import__(self.module_name, fromlist=['__name__'], level=0) File "/Library/Python/2.7/site-packages/mtools/mloginfo/mloginfo.py", line 75 timezone = f"UTC {tzdt.strftime('%z')}" ^ SyntaxError: invalid syntax

Steps to reproduce the actual/current behavior

Environment

I have installed in the machine python2 and python3.6

Software Version
mtools 1.6.1
MongoDB server 4.2
Operating system Mac OS X
python 2 and 3.6
@Simone-cogno Simone-cogno changed the title mloginfo "SyntaxError: invalid syntax mloginfo "SyntaxError: invalid syntax evens with python3.6 installed in the machine Jan 27, 2020
@Simone-cogno Simone-cogno changed the title mloginfo "SyntaxError: invalid syntax evens with python3.6 installed in the machine mloginfo "SyntaxError: invalid syntax even with python3.6 installed in the machine Jan 27, 2020
@Simone-cogno Simone-cogno changed the title mloginfo "SyntaxError: invalid syntax even with python3.6 installed in the machine mloginfo "SyntaxError: invalid syntax even with python3.6 installed on the machine Jan 27, 2020
@stennie
Copy link
Collaborator

stennie commented Jan 27, 2020

@Simone-cogno The Python path in your output indicates that you have installed mtools 1.6.1 into a Python 2.7 environment, which is not expected to be compatible with Python 3 syntax:

"/System/Library/Frameworks/Python.framework/Versions/2.7/"

Please uninstall mtools and reinstall into a Python 3.6+ environment (or install an older mtools version which is compatible with your default Python).

If you have both Python 2 & 3 installed and Python 2 is your default, you can use pip3 install to install into Python 3. You can use pip --version or pip3 --version to confirm which Python interpreter is associated with the pip install.

If you are still have difficulties working out how to install into the relevant Python environment, I suggest posting a question on Stack Overflow.

Thanks,
Stennie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants