Skip to content
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

Broken with Python 3.8+ on Windows #1435

Closed
oddMLan opened this issue Aug 31, 2021 · 2 comments
Closed

Broken with Python 3.8+ on Windows #1435

oddMLan opened this issue Aug 31, 2021 · 2 comments
Labels
feature New feature that should be supported
Milestone

Comments

@oddMLan
Copy link

oddMLan commented Aug 31, 2021

Apparently the Python Software Foundation in a moment of pure brilliance decided to break DLL resolution in Python 3.8+
"it's not a bug; it's a feature": https://bugs.python.org/issue43173

In 3.8+, the search path for the dependent DLLs of a normally imported extension module includes the following directories:

  • the loaded extension module's directory
  • the application directory (e.g. that of python.exe)
  • the user DLL search directories that get added by
    SetDllDirectory() and AddDllDirectory(), such as with
    os.add_dll_directory()
  • %SystemRoot%\System32

If possible, the simplest approach is to put dependent DLLs in the same directory as the extension module.

More details:
#589 (comment)

@liZe
Copy link
Member

liZe commented Sep 4, 2021

Hello!

Well… It’s probably time to follow what the Python devs say:

If your application relies on [DLL loading], you should check for add_dll_directory() and if it exists, use it to add your DLLs directory while loading your library.

@liZe
Copy link
Member

liZe commented Dec 11, 2021

This bug is now closed 🚀.

We’ve added a WEASYPRINT_DLL_DIRECTORIES environment variable to list folders where the DLL files can be found. Python 3.8+ will look there to find the libraries. The default value is the default folder of the GTK3 installer.

Feedback is welcome!

@grewn0uille grewn0uille added feature New feature that should be supported and removed bug Existing features not working as expected labels Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature that should be supported
Projects
None yet
Development

No branches or pull requests

3 participants