Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Python: Command not found when running mssql-scripter -h #281

Open
MazinAshfaq opened this issue Jun 15, 2023 · 1 comment
Open

Python: Command not found when running mssql-scripter -h #281

MazinAshfaq opened this issue Jun 15, 2023 · 1 comment

Comments

@MazinAshfaq
Copy link

OS: Mac OS Ventura
Python: Python3

Raising this issue for anyone who installed python3 with homebrew and then installed mssql-scripter following these instructions.
If you ever run into the error something like this. This is caused by an mismatch in the mssql-script bin file.

/opt/homebrew/bin/mssql-scripter: line 16: python: command not found

To fix this I found that editing the mssql-scripter file, which was created in:

/opt/homebrew/bin/,

and change the bottom line to use the python3 executable instead of python, changing this:

python -m mssqlscripter "$@"

to:

python3 -m mssqlscripter "$@"

Is there any way for the mssql-scripter file to check someones python version before executing either python or python3.

@iikuzmychov
Copy link

iikuzmychov commented Jul 3, 2023

True, after changing python to python3

mssqlscripter -h

works correctly, but

mssql-scripter -S ... -d ... -U ... -P ...

throws

No usable version of the libssl was found
Scripting request: 1 encountered error: Scripting request encountered a exception
Error details: ('End of stream reached, no output.',)

Reproducing

Environment: docker image mcr.microsoft.com/mssql/server:2019-latest

Step 1 - run sql-server container

docker run [IMAGE] -e ACCEPT_EULA=Y -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -d mcr.microsoft.com/mssql/server:2019-latest

Step 2 - update apt-get

docker exec -u root [CONTAINER] apt-get update

Step 3 - install pip3

docker exec -u root [CONTAINER] apt-get install python3-pip

Step 4 - install mssql-scripter

docker exec -u root [CONTAINER] pip3 install mssql-scripter

Step 5 - replace python with python3 in mssql-scripter

docker exec -u root [CONTAINER] sed -i "s/python/python3/g" /usr/local/bin/mssql-scripter

Final step - run

docker exec -u root [CONTAINER] mssql-scripter -S localhost -d [DATABASE] -U sa -P yourStrong(!)Password

No usable version of the libssl was found
Scripting request: 1 encountered error: Scripting request encountered an exception
Error details: ('End of stream reached, no output.',)

My solution

Do steps 1-5 from Reproducing and then do:

Step 6 - download multiarch

docker exec -u root [CONTAINER] wget http://snapshot.debian.org/archive/debian/20190501T215844Z/pool/main/g/glibc/multiarch-support_2.28-10_amd64.deb

Step 7 - depackage multiarch

docker exec -u root [CONTAINER] sh -c "dpkg -i multiarch-support*.deb"

Step 8 - download libssl1.0.0

docker exec -u root [CONTAINER] wget http://snapshot.debian.org/archive/debian/20170705T160707Z/pool/main/o/openssl/libssl1.0.0_1.0.2l-1%7Ebpo8%2B1_amd64.deb

Step 9 - depackage libssl1.0.0

docker exec -u root [CONTAINER] sh -c "dpkg -i libssl1.0.0*.deb"

Final step - run

docker exec -u root [CONTAINER] mssql-scripter -S localhost -d [DATABASE] -U sa -P yourStrong(!)Password

(you can try script master db for example)

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

No branches or pull requests

2 participants