Opened 11 years ago
Closed 11 years ago
#761 closed defect (fixed)
[Python 2.6] OrderedDict ImportError
Reported by: | rsd | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | programming | Keywords: | ordereddict python2.6 |
Cc: | cwebber@… | Parent Tickets: |
Description
When using Python 2.6, the ./bin/gmg dbupdate
command throws an ImportError[1].
The source of error is in the mediagoblin/processing/__init__.py
file, which imports 'OrderedDict' from 'collections'[2].
Fortunately, we've ordereddict[3]. When I imported 'OrderedDict' from this module. Bingo, it worked[4].
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'.
[1]: http://pastebin.com/c06J5H7j
[2]: In Python 2.6, there is no OrderedDict in 'collections'.
[3]: https://pypi.python.org/pypi/ordereddict
[4]: here is the diff http://pastebin.com/VYtQFW3a
Attachments (2)
Change History (7)
comment:1 by , 11 years ago
Keywords: | python2.6 added |
---|
by , 11 years ago
Attachment: | 0001-fixes-a-python2.6-specific-issue-related-to-OrderedD.patch added |
---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
Status: | new → review |
---|
by , 11 years ago
Attachment: | 0001-fixes-a-python2.6-specific-issue-related-to-OrderedD.2.patch added |
---|
comment:4 by , 11 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 , 11 years ago
Resolution: | → fixed |
---|---|
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.
Thanks.