From c9ece2e6b9365fa4be16bd0de25dd7b68c8dc97e Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 14 Feb 2015 19:51:43 -0500 Subject: [PATCH] Refs #24324 -- Fixed UnicodeDecodeError in makemigrations. If the project path contained a non-ASCII character, Python 2 crashed. --- django/db/migrations/writer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/django/db/migrations/writer.py b/django/db/migrations/writer.py index 37f2c81838..511913177f 100644 --- a/django/db/migrations/writer.py +++ b/django/db/migrations/writer.py @@ -15,6 +15,7 @@ from django.apps import apps from django.db import migrations, models from django.db.migrations.loader import MigrationLoader from django.utils import datetime_safe, six +from django.utils._os import upath from django.utils.encoding import force_text from django.utils.functional import Promise from django.utils.timezone import utc @@ -215,7 +216,7 @@ class MigrationWriter(object): if not hasattr(migrations_module, '__file__'): raise ImportError - basedir = os.path.dirname(migrations_module.__file__) + basedir = os.path.dirname(upath(migrations_module.__file__)) except ImportError: app_config = apps.get_app_config(self.migration.app_label) migrations_package_basename = migrations_package_name.split(".")[-1]