[Django] #29938: "int() argument must be a string or a number, not 'list'" error oracle 12.1 python

19 views
Skip to first unread message

Django

unread,
Nov 9, 2018, 8:38:22 AM11/9/18
to django-...@googlegroups.com
#29938: "int() argument must be a string or a number, not 'list'" error oracle 12.1
python
-------------------------------------+-------------------------------------
Reporter: kono10 | Owner: nobody
Type: Bug | Status: new
Component: Database | Version: 1.11
layer (models, ORM) | Keywords: oracle, oracle
Severity: Normal | 12.1, python 2.7
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When creating an initial migration in a new python project "python
manage.py migrate" I get the following error int() argument must be a
string or a number, not 'list'. I am using an oracle db version 12.1. I
was able to fix the error by chancing line 245 in lib/python2.7/site-
packages/django/db/backends/oracle/operations.py

**from**

def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue())

**to**

def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue()[0])


---- full error message

Operations to perform:
Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Applying contenttypes.0001_initial...Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/core/management/__init__.py", line 364, in
execute_from_command_line
utility.execute()
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/core/management/commands/migrate.py", line 204, in
handle
fake_initial=fake_initial,
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/migrations/executor.py", line 115, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake,
fake_initial=fake_initial)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/migrations/executor.py", line 145, in
_migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake,
fake_initial=fake_initial)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/migrations/executor.py", line 250, in
apply_migration
self.recorder.record_applied(migration.app_label, migration.name)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/migrations/recorder.py", line 73, in
record_applied
self.migration_qs.create(app=app, name=name)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/query.py", line 394, in create
obj.save(force_insert=True, using=self.db)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/base.py", line 808, in save
force_update=force_update, update_fields=update_fields)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/base.py", line 838, in save_base
updated = self._save_table(raw, cls, force_insert, force_update,
using, update_fields)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/base.py", line 924, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk,
raw)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/base.py", line 963, in _do_insert
using=using, raw=raw)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/query.py", line 1079, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/models/sql/compiler.py", line 1119, in
execute_sql
return self.connection.ops.fetch_returned_insert_id(cursor)
File
"/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7
/site-packages/django/db/backends/oracle/operations.py", line 245, in
fetch_returned_insert_id
return int(cursor._insert_id_var.getvalue())
TypeError: int() argument must be a string or a number, not 'list'

--
Ticket URL: <https://code.djangoproject.com/ticket/29938>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 9, 2018, 8:39:09 AM11/9/18
to django-...@googlegroups.com
#29938: "int() argument must be a string or a number, not 'list'" error oracle 12.1
python
-------------------------------------+-------------------------------------
Reporter: kono10 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle, oracle | Triage Stage:
12.1, python 2.7 | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by kono10:

Old description:

New description:

When creating an initial migration in a new python project "python
manage.py migrate" I get the following error int() argument must be a
string or a number, not 'list'. I am using an oracle db version 12.1. I
was able to fix the error by chancing line 245 in lib/python2.7/site-
packages/django/db/backends/oracle/operations.py

**from**

def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue())

**to**

def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue()[0])


---- full error message

**Operations to perform:

**

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29938#comment:1>

Django

unread,
Nov 9, 2018, 8:45:36 AM11/9/18
to django-...@googlegroups.com
#29938: "int() argument must be a string or a number, not 'list'" error oracle 12.1
python
-------------------------------------+-------------------------------------
Reporter: kono10 | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle, oracle | Triage Stage:
12.1, python 2.7 | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by kono10:

Old description:

> When creating an initial migration in a new python project "python


> manage.py migrate" I get the following error int() argument must be a
> string or a number, not 'list'. I am using an oracle db version 12.1. I
> was able to fix the error by chancing line 245 in lib/python2.7/site-
> packages/django/db/backends/oracle/operations.py
>
> **from**
>
> def fetch_returned_insert_id(self, cursor):
> return int(cursor._insert_id_var.getvalue())
>
> **to**
>
> def fetch_returned_insert_id(self, cursor):
> return int(cursor._insert_id_var.getvalue()[0])
>

> ---- full error message
>
> **Operations to perform:

> **

New description:

When creating an initial migration in a new python project "python
manage.py migrate" I get the following error int() argument must be a
string or a number, not 'list'. I am using an oracle db version 12.1. I
was able to fix the error by chancing line 245 in lib/python2.7/site-
packages/django/db/backends/oracle/operations.py

**from**
{{{
def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue())
}}}

**to**

{{{
def fetch_returned_insert_id(self, cursor):
return int(cursor._insert_id_var.getvalue()[0])
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/29938#comment:2>

Django

unread,
Nov 9, 2018, 9:47:36 AM11/9/18
to django-...@googlegroups.com
#29938: "int() argument must be a string or a number, not 'list'" error oracle 12.1
python
-------------------------------------+-------------------------------------
Reporter: kono10 | Owner: nobody
Type: Bug | Status: closed

Component: Database layer | Version: 1.11
(models, ORM) |
Severity: Normal | Resolution: wontfix

Keywords: oracle, oracle | Triage Stage:
12.1, python 2.7 | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):

* status: new => closed
* resolution: => wontfix


Comment:

Django 1.11 supports `cx_Oracle` < 7 (see
[https://docs.djangoproject.com/en/1.11/ref/databases/#oracle-notes
documentation] and ticket #29759). It seems that you're trying to use
`cx_Oracle` >= 7.

--
Ticket URL: <https://code.djangoproject.com/ticket/29938#comment:3>

Reply all
Reply to author
Forward
0 new messages