Python pymssql error "TypeError: argument of type 'NoneType' is not iterable" when connecting to SQL server -
i getting error "typeerror: argument of type 'nonetype' not iterable" when attempting connect sql server. believe error being generated on line connect sql server itself, second print statement never used, though wrong.
i using pymysql-2.1.3, , python 3.5.1
server = getenv("####") user = getenv("####") password = getenv("####") database = getenv("####") print("hi") conn = pymssql.connect(server, user, password, database) print("hi2") cursor = conn.cursor() cursor.execute("####" "select name, sourcetable, sourcetableid dbo.attachment name '%icad%'") conn.close() print("connect sql complete")
this results in error:
traceback (most recent call last): hi file "c:/convert.py", line 62, in <module> connect_to_sql() file "c:convert.py", line 15, in connect_to_sql conn = pymssql.connect(server, user, password, database) 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' not iterable process finished exit code 1
i have no idea why happening - connect function follows pymssql documentation exactly.
i importing following libraries if helps:
import os os import getenv import pymssql import subprocess
i have removed database credentials in question, know work able connect sql server via management studio.
does know why code doesn't work?
this code contained within function called 'connect_to_sql():' , used afterwards, of following code sensitive have cut these particular lines out. hope enough.
Comments
Post a Comment