After solve an error trying to migrate, now I'm facing another issue with the south
package.
Running manage.py syncdb
or manage.py schemamigration MyApp --initial
I get this:
AttributeError: 'module' object has no attribute '__file__'
This post mentions that the issue is solved with the new version (0.8.4
) but not for me 'cause I have the latest one.
I'm running over a virtual enviroment with python3.3 - Any clue?
If you didn't see the link or don't want to open it, here is the full stacktrace in plain text:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/management/commands/schemamigration.py", line 87, in handle
migrations = Migrations(app, force_creation=True, verbose_creation=int(verbosity) > 0)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 64, in __call__
self.instances[app_label] = super(MigrationsMetaclass, self).__call__(app_label_to_app_module(app_label), **kwds)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 90, in __init__
self.set_application(application, force_creation, verbose_creation)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 163, in set_application
self._load_migrations_module(application.migrations)
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 170, in _load_migrations_module
dirname = self.migrations_dir()
File "/home/hogar/Development/python/django/enviroments/share_this/lib/python3.3/site-packages/south/migration/base.py", line 132, in migrations_dir
return os.path.dirname(module.__file__)
AttributeError: 'module' object has no attribute '__file__'
The issue was that I was using python3.3 for the whole project but the initial python manage.py syncdb
command was entered using pyhon2.7, which will give me several issues later.
I noticed this after generate the project from the scratch and look an error in the output of manage.py syncdb
.
Then I deleted all the info from postgre-sql and, after source bin/activate
, run python3 manage.py syncdb
.