-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error loading libraries with Python 3.8 on Windows #90
Comments
I was looking through the Python 3.8 release notes, and there were quite a few ctypes patches. Nothing that immediately jumped out as a cause, but if we can make the pyglet code more robust then that's a good solution. I think the following change should work. It looks a little funky, but what about leaving that code snippet, but just moving it to the end?: for name in platform_names:
try:
lib = ctypes.cdll.LoadLibrary(name)
if _debug_lib:
print(name)
if _debug_trace:
lib = _TraceLibrary(lib)
return lib
except OSError as o:
path = self.find_library(name)
if path:
try:
lib = ctypes.cdll.LoadLibrary(path)
if _debug_lib:
print(path)
if _debug_trace:
lib = _TraceLibrary(lib)
return lib
except OSError:
pass
elif self.platform == "win32" and o.winerror != 126:
print("Unexpected error loading library %s: %s" % (name, str(o)))
raise If you had a chance to confirm that that works, that would be great! If not I'll see if I can get my test Windows VM upgraded to 3.8, and try there. |
Hey @pvcraven, I had a chance to try this myself, and it looks like it did the trick. The
|
The code sample you had here seems to work for me, and looks like the least-risky way to fix it. Thanks! |
This is included in the latest releases, so I'll close this for now. |
With Python 3.7 and versions before that, loading ffmpeg libraries is possible with Pyglet's
LibraryLoader.load_library()
inlib.py
.The same code that worked in Python 3.7 does not work under Python 3.8. The command
lib = ctypes.cdll.LoadLibrary(name)
on line 140 fails where it used to work. I'm not sure why. This line tries loading with just the file name, and not the full path.Later on in
lib.py
, Pyglet will try that library again with the full path. This would work under Windows, except right ahead of that is this code:This causes us to immediately fail before re-attempting with the full path. If that code is removed, execution continues and the library is successfully loaded on line 153.
Removing this code would allow pyglet-ffmpeg2 to work for supplying libraries for ffmpeg. But there might be a better solution.
The text was updated successfully, but these errors were encountered: