#24884: Migrations created in Python2.7 fail in Python3.4
----------------------------------------------+--------------------
     Reporter:  Chris7                        |      Owner:  nobody
         Type:  Uncategorized                 |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.8
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  0                             |      UI/UX:  0
----------------------------------------------+--------------------
 A migration file created with Python2.7 is failing with the following
 error in Python3.4:


 {{{
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/core/management/__init__.py", line
 338, in execute_from_command_line
     utility.execute()
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/core/management/__init__.py", line
 330, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/core/management/base.py", line 390,
 in run_from_argv
     self.execute(*args, **cmd_options)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/core/management/base.py", line 441,
 in execute
     output = self.handle(*args, **options)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/core/management/commands/migrate.py",
 line 221, in handle
     executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/migrations/executor.py", line
 110, in migrate
     self.apply_migration(states[migration], migration, fake=fake,
 fake_initial=fake_initial)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/migrations/executor.py", line
 147, in apply_migration
     state = migration.apply(state, schema_editor)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/migrations/migration.py", line
 115, in apply
     operation.database_forwards(self.app_label, schema_editor, old_state,
 project_state)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/migrations/operations/models.py",
 line 59, in database_forwards
     schema_editor.create_model(model)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/backends/base/schema.py", line
 261, in create_model
     self.quote_name(field.column),
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/backends/base/schema.py", line
 114, in quote_name
     return self.connection.ops.quote_name(name)
   File "/home/chris/.virtualenvs/djangui3/lib/python3.4/site-
 packages/Django-1.8.2-py3.4.egg/django/db/backends/sqlite3/operations.py",
 line 98, in quote_name
     if name.startswith('"') and name.endswith('"'):
 TypeError: startswith first arg must be bytes or a tuple of bytes, not str
 }}}

 The offending entry in my migration is:
 {{{
 ('_value', models.TextField(db_column=b'value')),
 }}}

 Removal of the b allows migration to carry on.

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.a93de9c67e1520d74fdcde0304ec7060%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to