Answer the question
In order to leave comments, you need to log in
Why can't connect to MS SQL database via python?
Hello. I have MS SQL Server installed on my computer, on the same computer I try to connect to the database using python, but the following error pops up:
>>> from os import getenv
>>> import pymssql
>>> server = getenv("КОМП\MSSQLSERVER")
>>> user = getenv("user")
>>> password = getenv("")
>>> conn = pymssql.connect(server, user, password, "Test")
Traceback (most recent call last):
File "<pyshell#5>", 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
Answer the question
In order to leave comments, you need to log in
Of course, I’m not a fake welder (I don’t know this Python library), but I strongly suspect that instead
of server = getenv("COMP \ MSSQLSERVER"),
you need to write
server = getenv("COMP")
But in users, on the contrary, add the name COMP.
Well, Russian letters in the server name cut the look
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question