-1

I have SQL Server installed on my computer, on the same computer I try to connect to the database using python, but I get the following error:

>>> from os import getenv
>>> import pymssql
>>> server = getenv(“КОМП”)
>>> user = getenv(“user”)
>>> password = getenv(“”)
>>> conn = pymssql.connect(server, user, password, “Test”)
    Traceback (most recent call last):
    File “<pyshell#6>”, line 1, in <module>
    conn = pymssql.connect(server, user, password, “Test”)
    File “pymssql.pyx”, line 635, in pymssql.connect (pymssql.c:10734)
    File “_mssql.pyx”, line 1902, in _mssql.connect (_mssql.c:21821)
    File “_mssql.pyx”, line 552, in _mssql.MSSQLConnection.__init__ (_mssql.c:5891)
    TypeError: argument of type ‘NoneType’ is not iterable

Friends please help. I guess I incorrectly wrote the name of the server, the user ... I attach the screenshot of the input window to the SQL Server database with the login data

login data

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418
Molodoy
  • 1
  • 1

1 Answers1

0
server = getenv("КОМП")

is returning None, and pymssql.connect is choking when it tries to resolve None as the server name. From your screenshot looks like you should simply be using

server = "КОМП"
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418