Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Django South 1.0 use iteritems()?

I've just installed South 1.0 and when I was about to do my first migration I got this error message:

... /lib/python3.4/site-packages/south/migration/migrators.py", line 186, in _run_migration
for name, db in south.db.dbs.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

I've fixed it by replacing two occurrences of iteritems() by items().
My questions are:

  • If South 1.0 is compatible with Python3, why is this happening?
  • Will my fix cause me any trouble?

I'm amazed by the fact that I couldn't find anyone experiencing the same problem.

like image 598
JBC Avatar asked Jul 02 '14 11:07

JBC


1 Answers

Update: South 1.0.1 was released on October 27th, 2014, which includes the fix for this issue:

South 1.0.1

This is a small bugfix release of South with two changes:

  • Python 3 compatability has been fixed (it was broken in 1.0 by an accidental introduction of iteritems())
  • South will explicitly error if it detects Django 1.7 or above rather than failing with cryptic errors.

My original answer follows below.


It appears Django-South does not really support Python 3, at least the project doesn't verify support before releasing. See this issue in the South tracker:

Has there been any progress with Python3 support? What is the current status?

I see a python3 related commit before the 0.8.3 release, wondering if it is complete or not.


It should sort of work, but if you want ongoing Python 3 support then you're better off using django 1.7's migrations, which are South's successor and have a full python 3 test suite.

Clearly the 'sorta' is 'not really'; the maintainer has shifted focus to the new migration infrastructure of Django 1.7.

0.8.4 was compatible, but this commit broke the compatibility again; your change should suffice to fix that issue. There is a pull request that addresses just that, but it has not yet been merged.

As 1.0 was only released yesterday, the reason you haven't found anyone else with the problem is because not many people have run into it yet.

Django 1.7's migration support is basically an integration of South into the mainline, and it supports Python 3 fully (automated tests are run for the full Django tree catching regressions like these). The first release candidate is out (see https://www.djangoproject.com/download/ for instructions on how to install it).

like image 177
Martijn Pieters Avatar answered Sep 19 '22 18:09

Martijn Pieters