Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何转换';Postgresql';在python中将biginger类型转换为integer?_Python_Postgresql_Odoo_Odoo 8 - Fatal编程技术网

如何转换';Postgresql';在python中将biginger类型转换为integer?

如何转换';Postgresql';在python中将biginger类型转换为integer?,python,postgresql,odoo,odoo-8,Python,Postgresql,Odoo,Odoo 8,以下是我的方法: def onchange_book_limit(self, cr, uid, ids, partner_id, context=None) if partner_id: cr.execute(""" select count(*) from rmkbook_issue where retflag!= 1 and partner_id = %s """ %(partner_id)) cnt=cr.fetchone() cnt

以下是我的方法:

def onchange_book_limit(self, cr, uid, ids, partner_id, context=None)   
    if partner_id:
       cr.execute(""" select count(*) from rmkbook_issue where retflag!= 1 and partner_id = %s """ %(partner_id))
       cnt=cr.fetchone()
       cnt1=integer(cnt[0])
       if(cnt1 > 3):
           cr.execute("""insert into testwizard(orderid1) values(%s)""" %(cnt1))
           raise osv.except_osv(_('Error!'), _('Sorry...You have exceeds the limit to take a book....!'))

    return partner_id

您是如何尝试转换它的?它是怎么失败的?你有例外吗?人们需要更多的信息来帮助你。这里使用的是什么数据库驱动程序<代码>psycopg2?还有别的吗?Python版本?请显示您收到的错误消息的确切文本。仅在插入查询中的cnt1之后添加后缀[0]即可解决此问题,即------->cr.execute(““”插入测试向导(orderid1)值(%s)”“”%(cnt1[0]))您是如何尝试将其转换的?它是怎么失败的?你有例外吗?人们需要更多的信息来帮助你。这里使用的是什么数据库驱动程序<代码>psycopg2?还有别的吗?Python版本?请显示您收到的错误消息的确切文本。只需在插入查询中的cnt1之后添加后缀[0]即可解决此问题,即---->cr.execute(““”插入测试向导(orderid1)值(%s)”“”%(cnt1[0]))