TeamPyOgg / PyOgg

Simple OGG Vorbis, Opus and FLAC bindings for Python
The Unlicense
63 stars 27 forks source link

Problems of loading opus library #97

Open CyberRex0 opened 2 years ago

CyberRex0 commented 2 years ago

There seems to be a problem with library_loader.py, which loads the Opus library.

In lines 104 to 105 of library_loader.py, it seems that a path is added to expand the library search range, but this prevents the globally installed Opus library from being loaded in some environments.

This is the REPL when we confirmed that the process of extending the search range was causing the problem:

>>> import ctypes.util
>>> ctypes.util.find_library('opus')
'libopus.so'
>>> import pyogg
>>> pyogg.OpusEncoder()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/pyogg/__init__.py", line 74, in __init__
    raise PyOggError("The Opus library wasn't found or couldn't be loaded (maybe you're trying to use 64bit libraries with 32bit Python?)")
pyogg.pyogg_error.PyOggError: The Opus library wasn't found or couldn't be loaded (maybe you're trying to use 64bit libraries with 32bit Python?)
>>> ctypes.util.find_library('opus')
>>>

Commenting out lines 104 and 105 eliminated this problem.

Additional Information