Changes between Version 1 and Version 2 of Ticket #29938


Ignore:
Timestamp:
Nov 9, 2018, 7:45:34 AM (6 years ago)
Author:
kono10
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29938 – Description

    v1 v2  
    11When 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
    22
    3 **from**     
     3**from**
     4{{{
     5def fetch_returned_insert_id(self, cursor):
     6      return int(cursor._insert_id_var.getvalue())
     7}}}
    48
     9**to**
     10
     11{{{
    512def fetch_returned_insert_id(self, cursor):
    6         return int(cursor._insert_id_var.getvalue())
    7 
    8 **to**
    9 
    10 def fetch_returned_insert_id(self, cursor):
    11     return int(cursor._insert_id_var.getvalue()[0])
    12 
    13 
    14 ---- full error message
    15 
    16 **Operations to perform:
    17   Apply all migrations: admin, auth, contenttypes, sessions
    18 Running migrations:
    19   Applying contenttypes.0001_initial...Traceback (most recent call last):
    20   File "manage.py", line 22, in <module>
    21     execute_from_command_line(sys.argv)
    22   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
    23     utility.execute()
    24   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    25     self.fetch_command(subcommand).run_from_argv(self.argv)
    26   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
    27     self.execute(*args, **cmd_options)
    28   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    29     output = self.handle(*args, **options)
    30   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
    31     fake_initial=fake_initial,
    32   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    33     state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
    34   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
    35     state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
    36   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
    37     self.recorder.record_applied(migration.app_label, migration.name)
    38   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
    39     self.migration_qs.create(app=app, name=name)
    40   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/db/models/query.py", line 394, in create
    41     obj.save(force_insert=True, using=self.db)
    42   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/db/models/base.py", line 808, in save
    43     force_update=force_update, update_fields=update_fields)
    44   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
    45     updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
    46   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
    47     result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
    48   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
    49     using=using, raw=raw)
    50   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
    51     return getattr(self.get_queryset(), name)(*args, **kwargs)
    52   File "/Users/jkonovsky/development/web_apps_main/mago_wd/magoenv/lib/python2.7/site-packages/django/db/models/query.py", line 1079, in _insert
    53     return query.get_compiler(using=using).execute_sql(return_id)
    54   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
    55     return self.connection.ops.fetch_returned_insert_id(cursor)
    56   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
    57     return int(cursor._insert_id_var.getvalue())
    58 TypeError: int() argument must be a string or a number, not 'list'
    59 **
     13        return int(cursor._insert_id_var.getvalue()[0])
     14}}}
Back to Top