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

Python38/Windows dll load directory #852

Closed
wants to merge 24 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion fiona/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import os
import sys
import warnings

import platform
from six import string_types
from collections import OrderedDict

Expand All @@ -77,6 +77,17 @@
class Path:
pass


# Add gdal dll directory on Windows and Python >= 3.8, see https://github.com/Toblerity/Fiona/issues/851
if platform.system() == 'Windows' and (3, 8) <= sys.version_info:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is add_dll_directory harmful when gdal dlls are already loaded? E.g. when multiple gdal binaries are present.


# Add GDAL_HOME/bin, if present
gdal_home = os.getenv('GDAL_HOME', None)

if gdal_home is not None and os.path.exists(gdal_home):
os.add_dll_directory(os.path.join(gdal_home, "bin"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If GDAL_HOME is set, but the directory does not exist, we should emit a warning



# TODO: remove this? Or at least move it, flake8 complains.
if sys.platform == "win32":
libdir = os.path.join(os.path.dirname(__file__), ".libs")
Expand Down