Skip to content

Commit

Permalink
Louis helper/Python 3.8: call os.add_dll_directory when importing lib…
Browse files Browse the repository at this point in the history
…luis DLL.

Python 3.8 adds os.add_dll_directory to securely load DLL's from known locations, which affects Louis helper when trying to load liblouis.dll from NVDA executable folder. Therefore add NVDA executable path to known DLL directories through os.add_dll_directory, which resolves ModuleNotFoundError.
  • Loading branch information
josephsl committed Feb 5, 2021
1 parent af482e1 commit 714db9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/louisHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

"""Helper module to ease communication to and from liblouis."""

import louis
# Python 3.8 changes the way DLL's are loaded due to security.
# Thus manually add NVDA executable path to DLL lookup path for loading liblouis.dll.
import os
with os.add_dll_directory(os.path.dirname(__file__)):
import louis
from logHandler import log
import config

Expand Down

0 comments on commit 714db9c

Please sign in to comment.