Miscellaneous

loadMacros

loadMacros

by joel robbin -
Number of replies: 1
I downloaded an orientation problem set from union college.
It works fine BUT if open problem 7, then open the editor,
then click on Take action (after making no changes) the
compilation fails with the following error message:

Can't locate macro file |parserOrientation.pl| via path: |.|, |/opt/webwork/courses/math112-robbin/templates/macros|, |/opt/webwork/pg/macros| at line 274 of (eval 335) Died within main::loadMacros called at line 3 of [TMPL]/tmpEdit/Orientation/prob09.pg.robbin.tmp

How can it be that the problem compiles in the one
case but not the other?

We have recently updated WeBWorK and changed the directory
structure. We had to reload some tables in the SQL database
when WeBWorK reported it couldn't find them. Is this relevant?
Does WeBWorK use the database to store .pl files?
In reply to joel robbin

Re: loadMacros

by Davide Cervone -
The reason for this error is that viewing the problem (even if you haven't edited it) causes a temporary copy to be made (note the name of the file that is being run: "[TMPL]/tmpEdit/Orientation/prob09.pg.robbin.tmp"), and that temporary file is not in the same location as the original file. The problem calls on a parserOrientation.pl file that is common to all the parser orientation problems, and is stored in the same directory as the problem files. The loadMacros() call will find it there because "." (the current directory) is in the macros path. But when you run the problem from the tmpEdit directory, the parserOrientation.pl file is no longer in the same directory, so loadMacros() doesn't find it.

Back in August, I fixed pg/macros/dangerousMacros.pl, which implements loadMacros(), to properly handle files being edited in the tmpEdit heirarchy. You may want to update that file to overcome this problem.

Davide