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

Modify mssql-cli bash wrapper to look for and prefer python3 #518

Open
JPvRiel opened this issue May 24, 2021 · 3 comments
Open

Modify mssql-cli bash wrapper to look for and prefer python3 #518

JPvRiel opened this issue May 24, 2021 · 3 comments

Comments

@JPvRiel
Copy link

JPvRiel commented May 24, 2021

On Ubuntu 20.04, the following install via pip does not work:

pip3 install --user mssqlcli

There are instructions to use a deb package for 18.04, but that's not an option. Related issues: #505, #482

In the bash wrapper to run this, I noticed python, and not python3, is assumed as the executable at

python -m mssqlcli.main "$@"

Some distributions (at least Debian/Ubuntu) facilitate the transition from python2 to python3 by having python point to python2 and python3 be a separate binary.

Instead of:

python -m mssqlcli.main "$@"

The following way of using command to check and match might help:

python_exe=$(command -v python3 || command -v python)
$python_exe -m mssqlcli.main "$@"

Then absolute path should be nicely resolved, e.g. /usr/bin/python3 for systems that have a binary found in the PATH.

@posguy99
Copy link

An install on macOS has the same problem, with the additional problem that it apparently assumes bash is the user's shell, without checking one way or the other.

@ethan-fox-capsule
Copy link

ethan-fox-capsule commented Jun 29, 2021

I've encountered this issue as well and just opened a ticket (#523) to elaborate on the problem further, specifically for my setup.

@joshuaclausen
Copy link

I have encountered the same thing - the /usr/local/bin/mssql-cli script hard-assumes "python" rather than looking for python3. I suppose another workaround might be creating a symbolic link so that the command "python" runs "python3".

The workarounds above worked for me.

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

No branches or pull requests

4 participants