File tree Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Expand file tree Collapse file tree 3 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 44import os
55import sys
66from enum import IntEnum
7+ from pathlib import Path
78from typing import Any
89
910import attr
@@ -130,11 +131,17 @@ class Encoder:
130131 def __init__ (self ) -> None :
131132 if sys .platform == "win32" :
132133 architecture = "x64" if sys .maxsize > 32 ** 2 else "x86"
133- directory = os .path .dirname (os .path .abspath (__file__ ))
134- name = os .path .join (directory , "../../bin" , f"opus-{ architecture } .dll" )
134+ directory = Path (__file__ ).parent .parent .parent
135+ name = directory / f"bin/opus-{ architecture } .dll"
136+ if not name .exists ():
137+ raise RuntimeError ("Could not find opus library." )
138+ name = str (name )
135139 else :
136140 name = ctypes .util .find_library ("opus" )
137141
142+ if name is None :
143+ raise RuntimeError ("Could not find opus library." )
144+
138145 self .lib_opus = ctypes .cdll .LoadLibrary (name )
139146
140147 for func_name , opt in exported_functions .items ():
You can’t perform that action at this time.
0 commit comments