LettError/MutatorMath

TypeError: '<' not supported between instances of 'NoneType' and 'str'

Closed this issue · 1 comments

On Python 3, MutatorMath throws an exception TypeError: '<' not supported between instances of 'NoneType' and 'str'. This can be reproduced by running python objects/mutator.py, which runs the doctests. Notice that this does not occur on Python 2.

The exception is raised in Mutator.getFactors() when sorting the list of deltas which are tuples of three values: a factor, an object to be compared, and either an axis name or None. Here:

The exception is due to a change in behavior between Python 2 and 3: the former allows comparing str and None, but Python 3 changes this behavior and raises an exception instead.

A possible fix for this could be to only sort the deltas tuple by the first two tuple items and disregard the last.

I have a fix on hand for this, pull request forthcoming.