Modify ↓
Ticket #31 (closed defect: fixed)
Confusing error in startmigration --initial if the directory already exists
| Reported by: | jacob@… | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | commands | Version: | |
| Keywords: | Cc: |
Description
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>
djangorecipe.manage.main('endorsements.settings')
File "/Users/jacob/Projects/endorsements/eggs/djangorecipe-0.12.1-py2.5.egg/djangorecipe/manage.py", line 15, in main
management.execute_manager(mod)
File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/__init__.py", line 340, in execute_manager
utility.execute()
File "/Users/jacob/Projects/endorsements/parts/django/django/core/management/__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
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.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

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