pronouncingpy icon indicating copy to clipboard operation
pronouncingpy copied to clipboard

python3.11

Open zhuokun opened this issue 1 year ago • 4 comments

AttributeError: partially initialized module 'pronouncing' has no attribute 'rhymes' (most likely due to a circular import)

zhuokun avatar Jan 18 '24 00:01 zhuokun

Please can you show the full error traceback and a small snippet of code that causes this?

hugovk avatar Jan 18 '24 05:01 hugovk

I'm also having trouble with 3.11.7. Downgrading to 3.10.13 works. It looks like something changed with calling string methods on items when iterating over file handles opened 'rb'.

pronouncing 0.2.0 cmudict 0.4.0 (I also tried the latest cmudict)

  File "/opt/homebrew/lib/python3.11/site-packages/pronouncing/__init__.py", line 51, in init_cmu
    pronunciations = parse_cmu(filehandle)
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/pronouncing/__init__.py", line 28, in parse_cmu
    if line.startswith(';'):
       ^^^^^^^^^^^^^^^^^^^^
TypeError: startswith first arg must be bytes or a tuple of bytes, not str

mdmunoz avatar Feb 20 '24 04:02 mdmunoz

Can you share a minimal code example that causes that?

hugovk avatar Feb 20 '24 08:02 hugovk

It was just

import pronouncing as P
P.init_cmu()

However, I just tried force-reinstalling pronouncing 0.2.0 with pip on 3.11 and it works. Something must have been wrong with my particular installation.

mdmunoz avatar Feb 20 '24 16:02 mdmunoz