jwdj / EasyABC

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

PDF printing in Linux (Mint 20) does not produce a file due to incorrect detection of gs_path #60

Closed topchyan closed 1 year ago

topchyan commented 1 year ago

No PDF export was possible for me, so I tried to print the contents of the line 937 of easy_abc.py

cmd2 = [gs_path, '-sDEVICE=pdfwrite', '-sOutputFile=%s' % pdf_file, '-dBATCH', '-dNOPAUSE', ps_file]

Here's the output I got

[b'/usr/bin/gs', '-sDEVICE=pdfwrite', '-sOutputFile=/home/avetik/.EasyABC/cache/temp.pdf', '-dBATCH', '-dNOPAUSE', '/home/avetik/.EasyABC/cache/temp.ps'] Note the first 'b'

The error messages contained the following:


 File "/media/avetik/SdCard/bin/EasyABC/easy_abc.py", line 5533, in export_tunes
    success = self.export_tune(tune, file_type, extension, convert_func, path, show_save_dialog=individual_save_dialog)
  File "/media/avetik/SdCard/bin/EasyABC/easy_abc.py", line 5458, in export_tune
    if convert_func(tune, filepath):
  File "/media/avetik/SdCard/bin/EasyABC/easy_abc.py", line 5203, in export_pdf
    pdf_file = AbcToPDF(self.settings, tune.abc, tune.header, self.cache_dir, self.settings.get('abcm2ps_extra_params', ''),
  File "/media/avetik/SdCard/bin/EasyABC/easy_abc.py", line 944, in AbcToPDF
    execmessages += '\nAbcToPDF\n' + " ".join(cmd2)
TypeError: sequence item 0: expected str instance, bytes found

Note 'bytes found'

Next, hard-coding the first parameter to /usr/bin/gs string solves for me the problem of not ever printing any PDF.

cmd2 = ['/usr/bin/gs', '-sDEVICE=pdfwrite', '-sOutputFile=%s' % pdf_file, '-dBATCH', '-dNOPAUSE', ps_file]

As the result I am getting the file printed nicely. I conclude that gs_path does not get detected properly.

jwdj commented 1 year ago

Should be fixed now.