Quantcast
Channel: CodeSection,代码区,Python开发技术文章_教程 - CodeSec
Viewing all articles
Browse latest Browse all 9596

django ‘int’ object has no attribute ‘keys’

$
0
0

django   ‘int’ object has no attribute ‘keys’
django ‘int’ object has no attribute ‘keys’

Posted on March 5, 2017 by Serdar Osman Onur

Being new to Django, sometimes I face interesting problems. If it is very late and you are very tired, It maynot always be easy to see the problem looking at the displayed error message like this int’ object has no attribute ‘keys’ error message I got in cursor.execute() method

This error was thrown on the line below:

cursor.execute(“select col1,col2 from table_namewhere col3= %s”, integer_value)

The reason I got this error was that I had provided the integer directly as an argument but according to the documentation the second argument must be a sequence or mapping. Below solved the issue:

cursor.execute(“select col1,col2 from table_namewhere col3= %s”, [integer_value])

Hope this helps.

Good Luck,

Serdar


django   ‘int’ object has no attribute ‘keys’

Serdar Osman Onur

Founder at DomainSwap - A Swap Market for Domain Names

I love coding web stuff, learning/applying new technologies and techniques to create things on the internet since 2004. AboutMe G+ twitter


django   ‘int’ object has no attribute ‘keys’

@serdarosmanonur

hard work, determination, dedication, patience, consistency, faith

Suraya bi' AR-GE tanm bile sgmyor.. ne ie yararsn twitter..? - 5 days ago


django   ‘int’ object has no attribute ‘keys’
django   ‘int’ object has no attribute ‘keys’

Latest posts by Serdar Osman Onur ( see all )

django ‘int’ object has no attribute ‘keys’ - March 5, 2017 Django NoReverseMatch Error - February 13, 2017 What is “related_name” used for in Django - January 24, 2017 RedHat JBOSS BPM Suite Installation Error No ‘jar’ binary detected in PATH - January 18, 2017 python Difference between “.append()” and “+= []” - January 17, 2017

Viewing all articles
Browse latest Browse all 9596

Trending Articles