|
15 | 15 |
|
16 | 16 | __version__ = "2.3.3" |
17 | 17 |
|
18 | | -if sys.platform.startswith('win'): |
19 | | - # This only works for Anaconda / miniconda |
20 | | - # On other systems, logic needs to be added here. |
21 | | - # there must be a better way to do this -- why doesn't conda take care of it? |
22 | | - libpath = os.path.join(os.path.split(sys.executable)[0], "Library", "bin") |
23 | | - |
24 | | - # Add lib dir to PATH: |
25 | | - if (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and |
26 | | - os.path.isfile(os.path.join(libpath, 'zlib.dll')) and |
27 | | - os.path.isfile(os.path.join(libpath, 'libgd.dll'))): |
28 | | - os.environ['PATH'] = libpath + os.pathsep + os.environ['PATH'] |
29 | | - |
30 | 18 | try: |
31 | 19 | from .py_gd import * # noqa: F401 |
32 | 20 |
|
33 | 21 | except ImportError as err: |
34 | | - if str(err).startswith("DLL load failed:"): |
35 | | - if not (os.path.isfile(os.path.join(libpath, 'libpng16.dll')) and |
36 | | - os.path.isfile(os.path.join(libpath, 'zlib.dll')) and |
37 | | - os.path.isfile(os.path.join(libpath, 'libgd.dll'))): |
38 | | - raise RuntimeError("Can't find dlls for libgd, libpng, and libz.\n" |
39 | | - "This kludge is only written to support Anaconda installs\n", |
40 | | - "you may need to add some logic for other library locations", |
41 | | - ) |
42 | | - else: |
43 | | - raise |
44 | | - else: |
45 | | - raise |
46 | | - print(err.args) |
| 22 | + raise RuntimeError("Can't find shared libs for libgd.\n" |
| 23 | + "Make sure they are installed, and on a path where they can be found.\n" |
| 24 | + "This may require some additional logic in this __init__.py," |
| 25 | + "But it would be better to use a standard system location" |
| 26 | + ) from err |
| 27 | + |
0 commit comments