EasyABC icon indicating copy to clipboard operation
EasyABC copied to clipboard

EasyAbc on macOS Sonoma (which has no native ps2pdf)

Open triplewhiskey opened this issue 2 years ago • 3 comments

Version used: 1.3.8.7 Python 3.10.11 In macOS Sonoma Apple removed the native ps2pdf support.

One can install Ghostscript via 'brew' or 'port' to overcome this shortage. However, with either of these solution EasyAbc will not produce a pdf file because of the ps2pdf binary is called with the '-o' option to name the output file. This produces the error: Usage: ps2pdfwr [options...] (input.[e]ps|-) [output.pdf|-]

Trinkerin with the code I found out that

  • installing Ghostscript ps2pdf via macports
  • and the following change will solve the problem: easy_abc.py:938: cmd2 = [gs_path, ps_file, pdf_file] instead of cmd2 = [gs_path, ps_file, '-o', pdf_file]

triplewhiskey avatar Nov 12 '23 14:11 triplewhiskey

Code Change to correct this in easy_abc.py:

Line 935ff:

convert ps to pdf

# p09 we already checked for gs_path in restore_settings() 2014-10-14
cmd2 = [gs_path, '-sDEVICE=pdfwrite', '-sOutputFile=%s' % pdf_file, '-dBATCH', '-dNOPAUSE', ps_file]
# [SS] 2015-04-08
if wx.Platform == "__WXMAC__":
    # [WJS] 2023-11-17 Fix for OSX Sonoma (works with ghostscript homebrew / macports)
    if int(platform.mac_ver()[0].split('.')[0]) > 13:
        cmd2 = [gs_path, ps_file, pdf_file] # [WJS] 2023-11-17 Fix for OSX Sonoma - no native ps2pdf
    else:
        cmd2 = [gs_path, ps_file, '-o', pdf_file]
if os.path.exists(pdf_file):
    os.remove(pdf_file)

triplewhiskey avatar Nov 21 '23 20:11 triplewhiskey

For information, I've created a branch to propose an integration of the shared library of Ghostscript for Mac. It allows in this case to avoid installing Ghostscript This is available here: https://github.com/aupfred/EasyABC/tree/easyabc1387-mac

aupfred avatar Jan 07 '24 22:01 aupfred

I was having the same problem on "EasyABC 1.3.8.1 FAU-Test 20210911" with Sonoma 14.2.1, having installed Ghostscript 10.02.1. Modifying the easy_abc.py to remove the '-o' worked for me after an app restart. Thanks.

christmasho avatar Jan 17 '24 13:01 christmasho