dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.35k stars 192 forks source link

Not working with Python 3.8 #499

Open rm1984 opened 3 years ago

rm1984 commented 3 years ago

Hi, this tool doesn't seem to work with recent versions of Python 3.

# mssql-cli
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/dist-packages/mssqlcli/main.py", line 11, in <module>
    from mssqlcli.config import config_location
ImportError: cannot import name 'config_location' from 'mssqlcli.config' (/usr/local/lib/python3.8/dist-packages/mssqlcli/config.py)

Thanks!

pensivebrian commented 3 years ago

Python 3.8 should work. Could you provide some more details so that we can try and reproduce this issue such as:

  1. OS version and arch
  2. mssql-cli version
  3. Output of pip freeze command.
ahstram commented 1 year ago

Looks like it might be a conflict with the package "mssqlcli".

I was having the same issue with python3.6 and mssql-cli-1.0.0

$ mssql-cli
Traceback (most recent call last):
  File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/astram/.local/lib/python3.6/site-packages/mssqlcli/main.py", line 11, in <module>
    from mssqlcli.config import config_location
ImportError: cannot import name 'config_location'

I fixed it with:

$ pip3 uninstall mssql-cli mssqlcli
$ pip3 install mssql-cli

then editing the last line of $(which mssql-cli) to change python to python3

mssql-cli is now working.