Opened 10 years ago
Closed 10 years ago
#761 closed defect (fixed)
[Python 2.6] OrderedDict ImportError
|Reported by:||rsd||Owned by:|
When using Python 2.6, the
./bin/gmg dbupdate command throws an ImportError.
The source of error is in the
mediagoblin/processing/__init__.py file, which imports 'OrderedDict' from 'collections'.
Fortunately, we've ordereddict. When I imported 'OrderedDict' from this module. Bingo, it worked.
A possible fix for this bug would be to first test whether importing OrderedDict from 'collections' doesn't throw an ImportError, if it does (meaning the user has Python 2.6), import OrderedDict from 'ordereddict'.
: In Python 2.6, there is no OrderedDict in 'collections'.
: here is the diff http://pastebin.com/VYtQFW3a
Change History (7)
comment:1 by , 10 years ago
by , 10 years ago
comment:2 by , 10 years ago
comment:3 by , 10 years ago
|Status:||new → review|
by , 10 years ago
comment:4 by , 10 years ago
The previous patch, I submitted is not clean as it (inadvertently) removes a period (`.') from the license block.
I've made a fresh patch, which is based on the latest commit (at the time of this comment); 6375cf735c.
This new patch is the second attachment in this ticket.
comment:5 by , 10 years ago
|Status:||review → closed|
Thanks for reporting this. Should have caught it before we went live with this release... erk ;|
Anyway, fixed in master, but not by providing the optional ordereddict module... really, we actually do not need OrderedDict necessarily, it just provides some nice, but not critical, ordering when displaying options on the command line. I updated git master so that when not OrderedDict is not supported that it uses a normal dict. I consider that a sufficient fix that doesn't add another dependency for 2.6.
Replying to rsd:
I've attached a patch, which fixes this issue.