0

When I execute the following command from a Ruby program run from Sublime2 (via the latter's "build" mechanism)

/usr/local/bin/convert /Users/palfvin/tmp/cover_sheet2.pdf -depth 8 /Users/palfvin/tmp/cover_sheet2.tiff

I get the following error:

convert: Postscript delegate failed `/Users/palfvin/tmp/cover_sheet2.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/678.

The input file is present and this command runs fine from the terminal. I modified the Sublime2 Ruby build settings so that the PATH environment variable is the same as in the terminal. I did a convert -list configure in both environments and the output is the same.

I gather from Convert: Postscript delegate failed and prior experience that the problem has to do with ghostscript execution, but I can't for the life of me figure out what could be causing this. Thanks in advance for any help.

Update 1: In response to first answer, here are the additional environment variables when running ruby from the terminal rather than from Sublime, excluding account/password vars (all vars from Sublime were exactly the same as their terminal counterparts). Note that the information is shown as an "array" because I obtained this by taking the output ENV in both contexts, converting that to an array and subtracting one from the other.

[["GEM_HOME", "/Users/palfvin/.rvm/gems/ruby-2.0.0-p247@avlats"],
  ["GEM_PATH", "/Users/palfvin/.rvm/gems/ruby-2.0.0-p247@avlats:/Users/palfvin/.rvm/gems/ruby-2.0.0-p247@global"],
  ["IRBRC", "/Users/palfvin/.rvm/rubies/ruby-2.0.0-p247/.irbrc"],
  ["LANG", "en_US.UTF-8"],
  ["MY_RUBY_HOME", "/Users/palfvin/.rvm/rubies/ruby-2.0.0-p247"],
  ["OLDPWD", "/Users/palfvin/avlats/spec"],
  ["PWD", "/Users/palfvin/avlats"],
  ["RUBY_VERSION", "ruby-2.0.0-p247"],
  ["SHLVL", "1"],
  ["TERM", "xterm-256color"],
  ["TERM_PROGRAM", "Apple_Terminal"],
  ["TERM_PROGRAM_VERSION", "309"],
  ["TERM_SESSION_ID", "8A3CDBC4-9495-40DC-A482-3297FE0BA614"],
  ["_", "/Users/palfvin/.rvm/rubies/ruby-2.0.0-p247/bin/ruby"],
  ["rvm_bin_path", "/Users/palfvin/.rvm/bin"],
  ["rvm_path", "/Users/palfvin/.rvm"],
  ["rvm_prefix", "/Users/palfvin"],
  ["rvm_version", "1.21.3 (stable)"]]
Community
  • 1
  • 1
Peter Alfvin
  • 28,599
  • 8
  • 68
  • 106

1 Answers1

0

Most likely it's some difference in configuration of the user that Ruby runs under and your own user. You need to check the environment of the 2 users, especially for any variable beginning GS_ and make sure it's the same in both cases.

halfer
  • 19,824
  • 17
  • 99
  • 186
KenS
  • 30,202
  • 3
  • 34
  • 51
  • I'm not sure why a different use would be involved in the case of Sublime running Ruby, particularly since I invoked Sublime from the command line. In any event, I dumped the values of `ENV` in both contexts and the differences didn't look significant. I included them above (except for account/password vars). – Peter Alfvin Nov 24 '13 at 14:47
  • Nope, no GS ones there. The error isn't a Ghostscript error, so there's not a lot more I can suggest – KenS Nov 24 '13 at 21:39