# Makeindex fails when called from a script

I've written a (python) script to automate my XeLaTeX run. What it does:

• creates a temp dir
• copies necessary tex, bib and image files into it from the cwd
• runs xelatex on the tex file
• runs biber on the file basename
• runs makeglossaries on the file basename
• runs xelatex x 2 on the tex file
• copies the resulting PDF back to current working dir

So far, so straightforward; I'm just emulating what I would do manually. However, my makeglossaries call fails with the following error:

makeglossaries version 2.02 (2011-04-02)
added glossary type 'main' (glg,gls,glo)
makeindex  -s "test-mmd3.ist" -t "/var/folders/In/Inv5nKauESSVg9ibb4l3c++++TI/-Tmp-/tmpG330ND/test-mmd3.glg" -o "/var/folders/In/Inv5nKauESSVg9ibb4l3c++++TI/-Tmp-/tmpG330ND/test-mmd3.gls" "/var/folders/In/Inv5nKauESSVg9ibb4l3c++++TI/-Tmp-/tmpG330ND/test-mmd3.glo"
Usage: makeindex [-ilqrcgLT] [-s sty] [-o ind] [-t log] [-p num] [idx0 idx1 ...]

***Call to makeindex failed***

Possible cause of problem:

Style name indicates makeindex, but may be in xindy format.
Remember to use \setStyleFile to specify the name
of the style file rather than redefining \istfilename
explicitly.

Check '/var/folders/In/Inv5nKauESSVg9ibb4l3c++++TI/-Tmp-/tmpG330ND/test-mmd3.glg' for details

I've checked that all the necessary files are being produced (in particular, the .ist file), openout_any is set to a, and the run completes fine when I do it manually using the same steps. I'm wondering if the error has anything to do with the the -s test-mmd3.ist option in makeindex; should it be using the full path, i.e. /var/folders/In/Inv5nKauESSVg9ibb4l3c++++TI/-Tmp-/tmpG330ND/test-mmd3.ist?

-
@urschrei: in which directory are you when running makeindex? In the doc dir or temp dir? And is the style file also copied into the temp dir? –  Herbert Apr 12 '11 at 12:20
In the temp dir, and yes, the style file is definitely there. –  urschrei Apr 12 '11 at 12:42
rename the style file to test-mmd3.mst instead of .ist. Then run makeindex without specifieing a style file with the -s option. –  Herbert Apr 12 '11 at 12:51
Unfortunately, I have no control over how it's called, since makeglossaries calls makeindex. I could just run Makeindex manually and skip makeglossaries (I'll never be using Xindy anyway), I suppose. –  urschrei Apr 12 '11 at 13:02
I doubt that you are in the temp directory when calling makeglossaries. A simple makeglossaries file doesn't show absolute pathes. Also I get exactly the same error/messages as you when I start makeglossaries from another directory with an absolute path as argument. I also get errors when I call makeglossaries from the document folder but still with an absolute path as argument but then the error message is slightly different. –  Ulrike Fischer Apr 12 '11 at 14:33

(Originally posted as a comment by Ulrike Fischer)

I doubt that you are in the temp directory when calling makeglossaries. A simple makeglossaries file doesn't show absolute paths. Also I get exactly the same error/messages as you when I start makeglossaries from another directory with an absolute path as argument. I also get errors when I call makeglossaries from the document folder but still with an absolute path as argument but then the error message is slightly different.

-
Xindy also has the same problem, we must copy the tex file to xindy's Temp folders, then xindy can work. –  WonderTree Oct 12 '12 at 6:43

For glossaries when it doesn't use Xindy, we have to use makeglossaries test.tex in the folder where test.tex is.
Xindy also has the similar path problem, but we must copy the tex file to xindy's Temp folders, then xindy just can work.

I use

xindy --interactive -L....

to find the temp folder of the xindy, then I copy the test.tex in it, it looks like:

/private/var/folders/9u/3d3edDd34trdetrgdDEffg/

Then I use

xelatex test.tex, makeglossaries test, xelatex test.tex

there, It works.

But it is so dirty, I don't know how to resolve it fine.

-