File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
src/torchcodec/decoders/_core Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -31,26 +31,26 @@ def load_torchcodec_extension():
3131 # correct .so file, so this for-loop succeeds on the first iteration.
3232
3333 exceptions = []
34+ pybind_ops_module_name = "_torchcodec_pybind_ops"
3435 for ffmpeg_major_version in (7 , 6 , 5 , 4 ):
3536 decoder_library_name = f"libtorchcodec_decoder{ ffmpeg_major_version } "
3637 custom_ops_library_name = f"libtorchcodec_custom_ops{ ffmpeg_major_version } "
3738 pybind_ops_library_name = f"libtorchcodec_pybind_ops{ ffmpeg_major_version } "
38- pybind_ops_module_name = "_torchcodec_pybind_ops"
3939 try :
4040 torch .ops .load_library (_get_extension_path (decoder_library_name ))
4141 torch .ops .load_library (_get_extension_path (custom_ops_library_name ))
42- torch .ops .load_library (_get_extension_path (pybind_ops_library_name ))
4342
43+ pybind_ops_library_path = _get_extension_path (pybind_ops_library_name )
4444 spec = importlib .util .spec_from_file_location (
4545 pybind_ops_module_name ,
46- _get_extension_path ( pybind_ops_library_name ) ,
46+ pybind_ops_library_path ,
4747 )
48- global _pybind_ops
4948 if spec is None :
50- _pybind_ops = importlib . import_module ( pybind_ops_module_name )
51- if _pybind_ops is None :
52- raise ImportError ( "Unable to load spec for pybind_ops" )
49+ raise ImportError (
50+ f"Unable to load spec for module { pybind_ops_module_name } from path { pybind_ops_library_path } "
51+ )
5352
53+ global _pybind_ops
5454 _pybind_ops = importlib .util .module_from_spec (spec )
5555 return
5656 except Exception as e :
You can’t perform that action at this time.
0 commit comments