Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.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
Python Django:“;类型为'的参数;int';是不合适的”;在oracle/base.py的_rowfactory中_Python_Django_Oracle_Apache - Fatal编程技术网

Python Django:“;类型为'的参数;int';是不合适的”;在oracle/base.py的_rowfactory中

Python Django:“;类型为'的参数;int';是不合适的”;在oracle/base.py的_rowfactory中,python,django,oracle,apache,Python,Django,Oracle,Apache,我正在尝试将Django应用程序连接到Oracle DB,但查询结果出现异常: TypeError: argument of type 'int' is not iterable 异常位置:/opt/isep/venv/lib/python3.4/site-packages/django/db/backends/oracle/base.py,在第560行工厂中 def _rowfactory(row, cursor): # Cast numeric values as the appropri

我正在尝试将Django应用程序连接到Oracle DB,但查询结果出现异常:

TypeError: argument of type 'int' is not iterable
异常位置:/opt/isep/venv/lib/python3.4/site-packages/django/db/backends/oracle/base.py,在第560行工厂中

def _rowfactory(row, cursor):
# Cast numeric values as the appropriate Python type based upon the
# cursor description, and convert strings to unicode.
casted = []
for value, desc in zip(row, cursor.description):
    if value is not None and desc[1] is Database.NUMBER:
        precision = desc[4] or 0
        scale = desc[5] or 0
        if scale == -127:
            if precision == 0:
                # NUMBER column: decimal-precision floating point
                # This will normally be an integer from a sequence,
                # but it could be a decimal value.
                if '.' in value:
                    value = decimal.Decimal(value)
                else:
                    value = int(value)
            else:
                # FLOAT column: binary-precision floating point.
                # This comes from FloatField columns.
                value = float(value)
        elif precision > 0:
            # NUMBER(p,s) column: decimal-precision fixed point.
            # This comes from IntField and DecimalField columns.
            if scale == 0:
                value = int(value)
            else:
                value = decimal.Decimal(value)
        elif '.' in value:
            # No type information. This normally comes from a
            # mathematical expression in the SELECT list. Guess int
            # or Decimal based on whether it has a decimal point.
            value = decimal.Decimal(value)
        else:
            value = int(value)
    elif desc[1] in (Database.STRING, Database.FIXED_CHAR,
                     Database.LONG_STRING):
        value = to_unicode(value)
    casted.append(value)
return tuple(casted)
值中的“
if.”行出现错误,因为
value=0

我使用的是:Python 3.4、Django 1.11、cx_Oracle 6.0


如何解决这个问题?

好的,我已经移除了我的静脉,然后创建了另一个。这次我安装了Django 1.11.15和cx_Oracle 6.0。一切似乎都很顺利。异常消失。

您能提供一个示例查询来进一步调查这个问题吗?只需简单的Django的Model.objects.all()