jwdj / EasyABC

EasyABC
GNU General Public License v2.0
87 stars 36 forks source link

EasyAbc on macOS Sonoma (which has no native ps2pdf) #80

Open triplewhiskey opened 9 months ago

triplewhiskey commented 9 months ago

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

triplewhiskey commented 9 months ago

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)
aupfred commented 7 months ago

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

christmasho commented 7 months ago

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.