def __init__(self, libinfo, libnames): self._dll = None foundlibs = _findlib(get_dll_path(), libnames) if len(foundlibs) == 0: raise RuntimeError("could not find any library for %s" % libinfo) for libfile in foundlibs: try: self._dll = ctypes.CDLL(libfile) self._libfile = libfile break except Exception as exc: # Could not load it, silently ignore that issue and move # to the next one. warnings.warn(exc, ImportWarning) if self._dll is None: raise RuntimeError("could not load any library for %s" % libinfo)
def test_get_set_dll_path(self): if sys.platform in ("win32", "cli"): self.assertIsNotNone(pygame2.get_dll_path()) else: self.assertIsNone(pygame2.get_dll_path())