sonipy icon indicating copy to clipboard operation
sonipy copied to clipboard

ImportError: from fractions import gcd

Open thorwhalen opened this issue 8 months ago • 0 comments

Just doing:

import sonipy.sonify

leads to

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
...
---> [19] from fractions import gcd 
...
ImportError: cannot import name 'gcd' from 'fractions'

Can replace this import with

try:
    from fractions import gcd
except ImportError:
    # because fractions.gcd doesn't exist in Python 3.11+
    from math import gcd

to accommodate new scipy versions (while sourcing from the same place if no import error).

thorwhalen avatar Jun 30 '24 13:06 thorwhalen