If you look closely to the screenshot, you will see that the error originates from canon-gen.py line 148 in the function “transform”. There you see direction=chosen_step
. From the screenshot it appears that chosen_step has been assigned a string ‘descending’. However, according to the music21 documentation, music21.scale.intervalNetwork — music21 Documentation direction should now be an enum instead of a string, so you will need to change the code in the canon-generator a bit not to use strings, but to use an enum instead (see the music21 documentation I linked to).
In other words, instead of strings like ‘ascending’ and ‘descending’, newer versions music21 now expect something like scale.Direction.ASCENDING or scale.Direction.DESCENDING.