Skip to content

Conversation

satra
Copy link
Member

@satra satra commented Sep 9, 2012

michael's condor changes

from ordereddict import OrderedDict
import sys
if not sys.version_info < (2, 7):
from ordereddict import OrderedDict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is it used? What happens for python 2.6?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic here is backwards, the ordereddict module is only needed in python 2.6 (or less) and in python 2.7 (or 3.x) we need to import OrderedDict from collections.

Not sure when the OrderedDict is used though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hanke: could you please send an updated change request (and perhaps test in your scenario with condor)?

if sys.version_info < (2, 7):
    from ordereddict import OrderedDict
else:
    from collections import OrderedDict

@moloney: the OrderedDict comes in when the config is read in config.py?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since OrderedDict is not in 2.6, i presume this is preferred.

if not sys.version_info < (2, 7):
    from collections import OrderedDict

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@satra I think you had it right the first time, but the ordereddict module also needs to be added to the dependencies in setup.py if the python version is less than 2.6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a branch with what I am proposing here: moloney@ff10dc7

This also addresses an issue where the original exception gets lost (and the crashdump does not get written) if an exception occurs within the try block but before importing savepkl. Let me know if you want me to open a separate pull request.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two thoughts.

  1. the only reason we have ordereddict is because configparser uses it in 2.7. therefore in 2.6 we don't have this awkwardness. that's why i suggested the change above. what do you think?
  2. regarding your changes could you please send a pull-request to my branch. i can include those in.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, makes sense that we don't need ordereddict for python < 2.7.

I opened a PR against your repo Satra: satra#14

satra added a commit that referenced this pull request Oct 17, 2012
@satra satra merged commit 89b24e6 into nipy:master Oct 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants