Ticket #31 (closed defect: fixed)

Opened 7 years ago

Last modified 5 years ago

Confusing error in startmigration --initial if the directory already exists

Reported by: jacob@… Owned by: andrew
Priority: major Milestone:
Component: commands Version:
Keywords: Cc:


If you issue startmigration --initial on an app that already has a migrations directory but doesn't have an __init__.py, you get a confusing error:

(endorsements)jacob@dorkbook:~/Projects/endorsements$ ./bin/django startmigration endorsements --initial
Traceback (most recent call last):
  File "./bin/django", line 25, in <module>
  File "/Users/jacob/Projects/endorsements/eggs/djangorecipe-0.12.1-py2.5.egg/djangorecipe/manage.py", line 15, in main
  File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/__init__.py", line 340, in execute_manager
  File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/__init__.py", line 295, in execute
  File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/base.py", line 77, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/base.py", line 96, in execute
    output = self.handle(*args, **options)
  File "/Users/jacob/Projects/endorsements/parts/svn-dependancies/south/management/commands/startmigration.py", line 89, in handle
    migrations = migration.get_migration_names(migration.get_app(app))
  File "/Users/jacob/Projects/endorsements/parts/svn-dependancies/south/migration.py", line 60, in get_migration_names
    for filename in os.listdir(os.path.dirname(app.__file__))
AttributeError: 'NoneType' object has no attribute '__file__'

[In this case I already had a "migrations" directory from a previous migration tool; it contains a bunch of SQL files, but no __init__.py.]

South should detect this situation and either create the needed empty __init__.py or give a more clear error.

Change History

comment:1 Changed 7 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in [95], by creating the init.py.

comment:2 Changed 7 years ago by andrew

I meant __init__.py, of course. Formatting fail.

comment:3 Changed 7 years ago by alarroste

Hello webmaster,
I would like to share with you a link, write to alarroste@…

Note: See TracTickets for help on using tickets.