Issue #4 new

Is installation on OS X supported?

created an issue

The trove classifiers claim

Operating System :: OS Independent

but installing python-ghostscript on OS X 10.7 and then trying to import ghostscript gives me:

>>> import ghostscript
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/lukasgraf/Plone/eggs/ghostscript-0.4.1-py2.7.egg/ghostscript/", line 33, in <module>
    import _gsprint as gs
  File "/Users/lukasgraf/Plone/eggs/ghostscript-0.4.1-py2.7.egg/ghostscript/", line 290, in <module>
    raise RuntimeError('Can not find Ghostscript library (libgs)')
RuntimeError: Can not find Ghostscript library (libgs)

The respective code in looks like it only takes win32 and linux platforms into consideration:

        libgs = cdll.LoadLibrary("")
    except OSError:
        # shared object file not found
        import ctypes.util
        libgs = ctypes.util.find_library('gs')
        if not libgs:
            raise RuntimeError('Can not find Ghostscript library (libgs)')
        libgs = cdll.LoadLibrary(libgs)

For OS X, it should probably look for a libgs.dylib, not an .so file.

Comments (2)

  1. lukasgraf reporter

    I quickly tried simply switching out .so with .dylib, that didn't work (even though there's a libgs.dylib on my System at /usr/local/Cellar/ghostscript/9.07/lib/libgs.dylib). So it doesn't seem to be as easy at that, I'll have to read up on how cdll.LoadLibrary and ctypes.util.find_library work exactly.

    If I can figure out how to change the setup code to work on OS X (without breaking it for Linux), I will submit a pull request. Otherwise, I could at least contribute some installation docs for OS X (setting the environment variable DYLD_LIBRARY_PATH= before installation should work I think).

  2. Log in to comment