iandol / scrivomatic

A writing workflow using Scrivener's style system + Pandoc for output…
https://iandol.github.io/scrivomatic/
GNU General Public License v3.0
297 stars 30 forks source link

Scrivomatic not finding tools in path #33

Closed theclue closed 4 years ago

theclue commented 4 years ago

Hi,

first of all, tnx for this workflow. It's impressive and I really hope to make this working to me, as it would be totally mindchanging :)

I'm using your compile preset to use Scrivomatic but when I compile a script it seems it won't find the tools.

Have a look to this log as an example:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.27 Report @ 2020-04-21 12:09:20 +0200 ===
=== ------------------------------------------------------ ===
 Working directory: ###############/Tutorial.md
 Initiating with Ruby 2.3.7
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="Tutorial.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="###############/bin:/Library/TeX/texbin:/usr/local/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
###############/bin:/Library/TeX/texbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Applications/Scrivener.app/Contents/Resources/MultiMarkdown/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.9.2.1
---pandocomatic:  | V: 
---ruby: /usr/bin/ruby | V: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
!--old ruby incompatible with newer pandocomatic, see https://github.com/iandol/scrivomatic/blob/master/Installing-Ruby.md
---rbenv: /usr/local/bin/rbenv
---python: /usr/local/bin/python
---xelatex: /Library/TeX/texbin/xelatex
---latexmk: /Library/TeX/texbin/latexmk

 … running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
Tool doesn't exist!!!

!!!---scrivomatic::runCommand() Couldn't find  to run, please supply a proper path!
  1. the ruby interpreter used is the system one, but I'm using an updated one coming from homebrew and located at /usr/local/opt/ruby/bin/ruby

  2. pandocomatic was installed as a gem in /usr/local/lib/ruby/gems/2.7.0/bin/pandocomatic.

Both are in the path in .bash_profle, but they don't seem to be in ENV PATH in Scrivomatic

Any idea?

iandol commented 4 years ago

I also noticed recently that something has changed in the way the path is found and that on one of my machines but not the other, the system ruby is used (in my case the system ruby is new enough so I don't get an error). Both my machines are on 10.15.4, so it isn't macOS per se but some interaction somewhere else...

I assume you are still on 10.14? When upgrading to Catalina, your system Ruby should at least be new enough (V2.6.3) and you can then install pandocomatic there (making sure the executable is in /usr/local/bin):

rbenv shell system
gem install pandocomatic -u /usr/local/bin

Let me look to see what I can find...

iandol commented 4 years ago

Another workaround is to run scrivomatic from your terminal manually where the path should then work properly, this issue only affects scripts when run from Scrivener's post-processing system I assume...

iandol commented 4 years ago

@theclue -- I solved this at least on my machine. It seems in my compile folder there was an rbenv config file .ruby-version that was set to system, so I got this:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.27 Report @ 2020-04-27 14:48:02 +0800 ===
=== ------------------------------------------------------ ===
 Working directory: /Users/ian/Desktop/Compile-mmd
 Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="NSFC\\ 2020\\ VR\\ v3.51.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.9.2.1
---pandocomatic: /Users/ian/.rbenv/shims/pandocomatic | V: 0.2.6
---ruby: /Users/ian/.rbenv/shims/ruby | V: ruby 2.6.3p62 (2019-04-16 revision 67580)[universal.x86_64-darwin19]
---rbenv: /usr/local/bin/rbenv

then I removed it (you could also edit it and put the version of ruby you want to use), and I got this:

=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.27 Report @ 2020-04-27 14:39:57 +0800 ===
=== ------------------------------------------------------ ===
 Working directory: /Users/ian/Desktop/Compile-mmd
 Initiating with Ruby 2.6.3
===------ Input Options: ------===
#<struct Scrivomatic::OPT input="NSFC\\ 2020\\ VR\\ v3.51.md", output=nil, to=nil, yaml=nil, command="pandocomatic", envpath="/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true, data_dir=nil>
===------ Final ENV PATH: ------===
/Users/ian/bin:/Users/ian/.rbenv/shims:/Library/TeX/texbin:/usr/local/bin:/Users/ian/miniconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
===------ TOOL PATHS: ------===
---pandoc: /usr/local/bin/pandoc | V: 2.9.2.1
---pandocomatic: /Users/ian/.rbenv/shims/pandocomatic | V: 0.2.6
---ruby: /Users/ian/.rbenv/shims/ruby | V: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]
---rbenv: /usr/local/bin/rbenv

I've made a tiny update to scrivomatic (V1.0.28) to log the rbenv versions out so I can see which ruby is being used...

iandol commented 4 years ago

@theclue -- ah, I misread your comment: you are not using rbenv to install your ruby...

I do not check for the Ruby installed by homebrew, only rbenv at the moment. I can try to add the paths, although the homebrew install paths are not very friendly, as gems install in folders that have a version number and that is not stable. You can manually add symlinks to ~/bin

But my recommendation is to use rbenv.

Scrivener does not pick up any custom paths set in bash or zsh, that is why I had to write scrivomatic in the first place ;-)

iandol commented 4 years ago

I've added the V2.7.x /usr/local/opt/ruby/bin and /usr/local/lib/ruby/gems/2.7.0/bin to the path scrivomatic (V1.0.29) builds so in theory a homebrew ruby should be found if installed, but rbenv will take priority if also present. If the brew ruby updates to V2.8, then I'll rewrite the path to keep current...

theclue commented 4 years ago

Many tnx! Will try it ASAP!