#24651: makemigrations: AttributeError: 'bytes' object has no attribute
'pattern'
(Django 1.8/Python 3.4)
----------------------------+--------------------------------------
Reporter: ldgarcia | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by scailer):
* status: closed => new
* resolution: needsinfo =>
Comment:
I get same problem, when porting my code to python 3.
Django on python2 create migration with byte-strings in code:
{{{
apps/post/migrations/0001_initial.py: ('picture',
models.ImageField(upload_to=b'images/posts/%Y_%m/%d', null=True,
verbose_name='Picture', blank=True)),
apps/post/migrations/0001_initial.py: ('lang_code',
models.ForeignKey(default=b'en', verbose_name='Language',
to='account.Language')),
}}}
And when we run it in python3 environ it crashes.
Works for me fix:
{{{
$ find apps -type f -exec sed -i "s/{b'/{'/g" {} \;
$ find apps -type f -exec sed -i "s/(b'/('/g" {} \;
$ find apps -type f -exec sed -i "s/ b'/ '/g" {} \;
$ find apps -type f -exec sed -i "s/=b'/='/g" {} \;
$ find apps -type f -exec sed -i "s/\[b'/\['/g" {} \;
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24651#comment:2>
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/066.dc310ebb9445fedb63b6047819fb753d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.