I'm using
windows xp64
python 2.5
pymssql 1.0.0 (installed with windows setup)
the following code snippet generate an error
>>> import pymssql
>>> con = pymssql.connect(user="sa", password="xxxx", host="xp4buildste\\test", database="test_db")
>>> cur=con.cursor()
>>> cur.execute("select * from sys_config")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
cur.execute("select * from sys_config")
File "D:\Python25\Lib\site-packages\pymssql.py", line 182, in execute
self._source.execute_query(operation, params)
TypeError: not all arguments converted during string formatting
I get no error if I have a (at least) parameter to my query
>>> cur.execute("select * from sys_config where 1=%d", 1)
I saw example on the web using execute() w/o parameters, but I'm not able to have them run
BTW _mssql.execute_query() works
any ideas?
cheers
stefano
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes I overlooked this. The quickest remedy is to change one line in pymssql.py:
def execute(self, operation, params = None):
into
def execute(self, operation, params = ()):
This will be fixed in 1.0.1 in a few days.
Sorry for the inconvenience,
Andrzej
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using
windows xp64
python 2.5
pymssql 1.0.0 (installed with windows setup)
the following code snippet generate an error
>>> import pymssql
>>> con = pymssql.connect(user="sa", password="xxxx", host="xp4buildste\\test", database="test_db")
>>> cur=con.cursor()
>>> cur.execute("select * from sys_config")
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
cur.execute("select * from sys_config")
File "D:\Python25\Lib\site-packages\pymssql.py", line 182, in execute
self._source.execute_query(operation, params)
TypeError: not all arguments converted during string formatting
I get no error if I have a (at least) parameter to my query
>>> cur.execute("select * from sys_config where 1=%d", 1)
I saw example on the web using execute() w/o parameters, but I'm not able to have them run
BTW _mssql.execute_query() works
any ideas?
cheers
stefano
Yes I overlooked this. The quickest remedy is to change one line in pymssql.py:
def execute(self, operation, params = None):
into
def execute(self, operation, params = ()):
This will be fixed in 1.0.1 in a few days.
Sorry for the inconvenience,
Andrzej
thank you for the light-speed response!!!
it works
cheers
stefano