cspogil icon indicating copy to clipboard operation
cspogil copied to clipboard

build.py Not Working on Windows

Open t-liv057 opened this issue 7 years ago • 11 comments

build.py won't run on windows. It's possibly a problem with MikTex compatibility or it is a problem with the backslashes on line 26-27.

t-liv057 avatar Apr 04 '17 15:04 t-liv057

I ran into this, too. (Although I can compile, say, CS1/Act01 just fine by doing a 'cd' into that directory, then running pdflatex Act01-Introduction.tex)

Would it be possible to pre-compile the .PDF files, and leave those somewhere?

MikeTheGreat avatar Jul 30 '17 00:07 MikeTheGreat

I would rather fix this issue than include PDFs in the repository, because they change every time you compile (due to time stamps embedded in the PDF) regardless whether the source has changed. It's just that I don't have a Windows machine handy to figure out the syntax, and it's pretty low on my to-do list.

ChrisMayfield avatar Jul 31 '17 18:07 ChrisMayfield

I'm on Mac so can't directly test and debug this. Can someone give the contents of _TEMP_1.run and _TEMP_2.run after the failure? They'll be in the directory of the activity being built. (E.g., CS0\Act01_TEMP_1.run).

FYI, I suspect the single quotes. The commands being generated on 26-27 look like this:

pdflatex -interaction=nonstopmode '\def\Student{}\input{TEMP.tex}' > _TEMP_1.run

Those backslashes are latex commands. The goal is to get them passed into pdflatex. I wonder if the single quotes are the right way to prevent DOS from processing its contents and pass it through raw?

You might try changing these to single quotes. So in build.py

cmd = LATEX + " \"\\def\\" + suff + "{}\\input{_TEMP_.tex}\"" 

StoneyJackson avatar Jan 17 '18 15:01 StoneyJackson

With that insight, I'm tempted to spin up a Windows VM and finally knock out this issue. :)

ChrisMayfield avatar Jan 17 '18 16:01 ChrisMayfield

I just re-ran the build.py, and here are my _TEMP_1/2.run files (I tacked '.txt' onto the name because GitHub didn't like the .run files)

_TEMP_1.run.txt _TEMP_2.run.txt

THANK YOU for looking at this!! :)

MikeTheGreat avatar Jan 17 '18 18:01 MikeTheGreat

@MikeTheGreat Thanks for posting those files.

They appear to confirm my suspicion. In particular, this line:

! I can't find file `''.

I think this is saying that LaTeX cannot find a file by the name of ' (single quote). I think my previous suggestion would work under Windows.

Further, I don't think any of the characters in the LaTeX command are special to CMD.exe (c.f., this article). So we probably don't need to quote or escape them at all. So this might work.

cmd = LATEX + " \\def\\" + suff + "{}\\input{_TEMP_.tex}"

@MikeTheGreat Care to try to make the change and let us know if it works or not and what output you get if it fails?

If either of the above solutions work, then build.py will need to check which OS it's running on (c.f. this article) and build the right string.

StoneyJackson avatar Feb 11 '18 21:02 StoneyJackson

That's much better! It now appears to be running (at least until it hits another error)

The next error is from pdflatex. The output on the console is:

CS0\Act04\interactions.tex
  Teacher...OK
  Student...

Sorry, but pdflatex did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/mike/AppData/Local/MiKTeX/2.9/miktex/log/pdflatex.log

You may want to visit the MiKTeX project page, if you need help.
ERROR

Looking at the log file I see (at the very end):

2018-02-15 14:41:14,605-0800 FATAL pdflatex - Invalid argument: path="_TEMP_.out"
2018-02-15 14:41:14,621-0800 FATAL pdflatex - Info: path="_TEMP_.out"
2018-02-15 14:41:14,621-0800 FATAL pdflatex - Source: Libraries\MiKTeX\Core\File\win\winFile.cpp
2018-02-15 14:41:14,621-0800 FATAL pdflatex - Line: 488

I'd like to dig into this. I also got a phone call and a meeting soon, so we'll see how far I get :)

MikeTheGreat avatar Feb 15 '18 22:02 MikeTheGreat

Huh. So I tweaked build.py so that it wouldn't remove the TEMP.out files (so I could compare the TEMP.out file of working directories to the CS0\Act04 directory) and then I re-ran it and now everything works fine.

Months ago I built a couple of these things activity-by-activity, and it looks like the temporary files that I didn't delete were causing problems.

MikeTheGreat avatar Feb 15 '18 22:02 MikeTheGreat

@MikeTheGreat I'm glad that worked for you 👍. But I'm not sure why it worked for you 😕 .

So, I suggest closing this issue for now. If you can't, then maybe poke @ChrisMayfield (OK, I just did).

StoneyJackson avatar Feb 16 '18 17:02 StoneyJackson

Nuts - how do I close this? @ChrisMayfield - can I do this on my own or should I bug you? :)

MikeTheGreat avatar May 09 '18 01:05 MikeTheGreat