Bug #72001 django connector: iteritems() not supported in python 3
Description:
Trying to run syncdb with a fixture in django 1.6, with python 3.2:
./manage.py syncdb
Creating tables ...
Installing custom SQL ...
Installing indexes ...
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/usr/lib64/python3.2/site-packages/django/core/management/commands/syncdb.py", line 162, in handle_noargs
database=db, skip_validation=True)
File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 159, in call_command
return klass.execute(*args, **defaults)
File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/usr/lib64/python3.2/site-packages/django/core/management/commands/loaddata.py", line 55, in handle
self.loaddata(fixture_labels)
File "/usr/lib64/python3.2/site-packages/django/core/management/commands/loaddata.py", line 90, in loaddata
connection.check_constraints(table_names=table_names)
File "/usr/lib64/python3.2/site-packages/mysql/connector/django/base.py", line 617, in check_constraints
self.introspection.get_primary_key_column(cursor, table_name)
File "/usr/lib64/python3.2/site-packages/mysql/connector/django/introspection.py", line 146, in get_primary_key_column
for column in self.get_indexes(cursor, table_name).iteritems():
AttributeError: Problem installing fixtures: 'dict' object has no attribute 'iteritems'
The error is pretty simple: iteritems function was removed from python 3.*
How to repeat:
Try to syncdb in django with a fixture of some simple models, or just call make some unit testing on instrospection.get_primary_key_column
Suggested fix:
I've just commented in ysql/connector/django/introspection.py the las function "get_primary_key_column" (in django introspection.py module there isn't such function) and everything works fine, but I don't think that as was o good solution.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Trying to run syncdb with a fixture in django 1.6, with python 3.2: ./manage.py syncdb Creating tables ... Installing custom SQL ... Installing indexes ... Traceback (most recent call last): File "./manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line utility.execute() File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 242, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 415, in handle return self.handle_noargs(**options) File "/usr/lib64/python3.2/site-packages/django/core/management/commands/syncdb.py", line 162, in handle_noargs database=db, skip_validation=True) File "/usr/lib64/python3.2/site-packages/django/core/management/__init__.py", line 159, in call_command return klass.execute(*args, **defaults) File "/usr/lib64/python3.2/site-packages/django/core/management/base.py", line 285, in execute output = self.handle(*args, **options) File "/usr/lib64/python3.2/site-packages/django/core/management/commands/loaddata.py", line 55, in handle self.loaddata(fixture_labels) File "/usr/lib64/python3.2/site-packages/django/core/management/commands/loaddata.py", line 90, in loaddata connection.check_constraints(table_names=table_names) File "/usr/lib64/python3.2/site-packages/mysql/connector/django/base.py", line 617, in check_constraints self.introspection.get_primary_key_column(cursor, table_name) File "/usr/lib64/python3.2/site-packages/mysql/connector/django/introspection.py", line 146, in get_primary_key_column for column in self.get_indexes(cursor, table_name).iteritems(): AttributeError: Problem installing fixtures: 'dict' object has no attribute 'iteritems' The error is pretty simple: iteritems function was removed from python 3.* How to repeat: Try to syncdb in django with a fixture of some simple models, or just call make some unit testing on instrospection.get_primary_key_column Suggested fix: I've just commented in ysql/connector/django/introspection.py the las function "get_primary_key_column" (in django introspection.py module there isn't such function) and everything works fine, but I don't think that as was o good solution.