I am using Msys2 from PortableApps under Win10.
I cannot run bzr
. I am adding below the output of a few command that illustrate the issue, and provide information that can guide the answer:
$ bzr
File "/c/Users/ry16205/Documents/appls_mydocs/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.7/site.py", line 177
file=sys.stderr)
^
SyntaxError: invalid syntax
$ type bzr
bzr is hashed (/usr/bin/bzr)
$ python2 /usr/bin/bzr
File "/c/Users/ry16205/Documents/appls_mydocs/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.7/site.py", line 177
file=sys.stderr)
^
SyntaxError: invalid syntax
$ python2 -m trace --count /usr/bin/bzr
File "/c/Users/ry16205/Documents/appls_mydocs/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.7/site.py", line 177
file=sys.stderr)
^
SyntaxError: invalid syntax
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:...
$ type python
python is hashed (/usr/bin/python)
$ type python2
python2 is hashed (/usr/bin/python2)
$ head -1 /usr/bin/bzr
#!/usr/bin/python2
$ python --version
Python 3.7.4
$ echo $PYTHONPATH
/c/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.7:/c/PortableApps/MSYS2Portable/App/msys32/mingw64/lib/python3.7/site-packages
My main question is:
How can I execute bzr
commands, without radically changing my configuration / removing python3?
In addition, I wonder why the trace
did not show more info than it did.
This appears to be happening because your PYTHONPATH is pointing at a Python3-specific path, and it contains python files that Python 2 can not parse.
Unsetting PYTHONPATH, either permanently or just for bzr, should resolve the issue:
$ PYTHONPATH= bzr rocks