Skip to content

Commit 89c8698

Browse files
committed
Trying import_module as backup
1 parent 6819070 commit 89c8698

File tree

1 file changed

+3
-3
lines changed
  • src/torchcodec/decoders/_core

1 file changed

+3
-3
lines changed

src/torchcodec/decoders/_core/ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ def load_torchcodec_extension():
4545
pybind_ops_module_name,
4646
_get_extension_path(pybind_ops_library_name),
4747
)
48+
global _pybind_ops
4849
if spec is None:
49-
spec = importlib.util.find_spec(pybind_ops_module_name)
50-
if spec is None:
50+
_pybind_ops = importlib.util.import_module(pybind_ops_module_name)
51+
if _pybind_ops is None:
5152
raise ImportError("Unable to load spec for pybind_ops")
5253

53-
global _pybind_ops
5454
_pybind_ops = importlib.util.module_from_spec(spec)
5555
return
5656
except Exception as e:

0 commit comments

Comments
 (0)