3

My problem: I am using Python to print plots which I usually output as .pdf file. Now I want to use .eps files, but Ghostscript is required (which I noticed because my Python console gave the error "Command gs not found").

Now I installed Ghostscript and I even went so far as to write an AutoRun into the registry under HKEY_CURRENT_USER -> Software -> Microsoft -> CommandProcessor with the value set to a .cmd file where I define an alias doskey gs=gswin64c (since on Windows the executable is named gswin64c but Python wants to run the Linux version gs).

Anyway, I still get the error. The bottom of the Python console prints: gs_distill your image.\nHere is the full report generated by ghostscript:\n\n' + fh.read()) TypeError: Can't convert 'bytes' object to str implicitly.

I believe the error is connected to Python not being able to run Ghostscript, but don't know where to go from here. Any solutions? Thanks in advance!

4
  • Can you try add the python offending command you used? Give it a look here tooand maybe even more this answer. Ps Welcome on SuperUser
    – Hastur
    Jul 21, 2016 at 12:49
  • The offending line was plt.savefig(r'{}.eps'.format(filename), format="eps", dpi=1000). Anyhow, I kinda solved my problem by... well, rebooting. Seems like either Ghostscript or the registry edit needed a reboot to properly function.
    – Ian
    Jul 21, 2016 at 13:18
  • "accept yourself" ... when you can. :). Good.
    – Hastur
    Jul 21, 2016 at 13:26
  • In another 2 days! :D Thanks for the help, though!
    – Ian
    Jul 21, 2016 at 13:27

1 Answer 1

2

Well, this is awkward. Rebooting solved my problem. It seems like I did the right steps, but without reboot it wouldn't work. Maybe this can be of help for someone else in the future.

1
  • To reboot the computer is not always needed, can be enough to restart any explorer instance, but often helps.
    – Hastur
    Jul 21, 2016 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.