Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#4743 closed (invalid)

MySQLdb version check is flakey

Reported by: admin@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

when I try to execute the following command gives me an error:

python syncdb

Traceback (most recent call last):
  File "", line 11, in <module>
  File "/usr/lib/python2.5/site-packages/django/core/", line 1672, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/usr/lib/python2.5/site-packages/django/core/", line 1571, in execute_from_command_line
    action_mapping[action](int(options.verbosity), options.interactive)
  File "/usr/lib/python2.5/site-packages/django/core/", line 486, in syncdb
    from django.db import connection, transaction, models, get_creation_module
  File "/usr/lib/python2.5/site-packages/django/db/", line 11, in <module>
    backend = __import__('django.db.backends.%s.base' % settings.DATABASE_ENGINE, {}, {}, [''])
  File "/usr/lib/python2.5/site-packages/django/db/backends/mysql/", line 20, in <module>
    raise ImportError, "MySQLdb-1.2.1p2 or newer is required; you have %s" % Database.__version__
ImportError: MySQLdb-1.2.1p2 or newer is required; you have 1.2.2

Note the last line

Change History (5)

comment:1 Changed 16 years ago by Chris Beaven

Component: UncategorizedDatabase wrapper
Owner: changed from Jacob to Adrian Holovaty
Summary: python syncdbMySQLdb version check is flakey
Triage Stage: UnreviewedAccepted

comment:2 Changed 16 years ago by Ramiro Morales

comment:3 Changed 16 years ago by Chris Beaven

Hmm, submitter said (in IRC chat) that python -c "import MySQLdb;print MySQLdb.version_info" returns (1,2,2,'final',0).

But testing that against the version code in SVN (django.db.backends.mysql.base) works fine:

>>> version = (1,2,2,'final',0)
>>> (version < (1,2,1) or (version[:3] == (1, 2, 1) and
        (len(version) < 5 or version[3] != 'final' or version[4] < 2)))

So I'm not sure how it's raising the error. admin@javadn, are you using the SVN version?

comment:4 Changed 16 years ago by Malcolm Tredinnick

Description: modified (diff)
Resolution: invalid
Status: newclosed

Chris: you have to be careful interpreting the output here. This is the Fedora 7 bug (not a Django bug). You can tell because the output from that print statement does not include any spaces after the commas. So Python isn't formatting the tuple for output. It's returning a string and display that literally. The string in the Fedora 7 rpm does not include spaces (apparently they don't believe in backwards compatibility or good typography practices).

What you really want to ask for when querying people about this is type(version_info) or repr(version_info). Tuple, good; string, bad.

I'm going to close this as invalid. It's not our bug and hopefully Fedora will fix it soon.

comment:5 Changed 16 years ago by Simon G. <dev@…>

#5008's a duplicate

Note: See TracTickets for help on using tickets.
Back to Top