WeBWorK Problems

path to context?

path to context?

by Kenneth Appel -
Number of replies: 1
In our WeBWorK installation,
contextIntegerFunctions.pl is in directory
/web/opt/pg/macros along with most other contexts.

This makes the error below hard to interpret.
WeBWorK Error
WeBWorK has encountered a software error while attempting to process this problem. It is likely that there is an error in the problem itself. If you are a student, report this error message to your professor to have it corrected. If you are a professor, please consult the error output below for more information.

Error messages

Can't locate macro file |contextIntegerFunctionspl| via path: |.|, |/opt/webwork2/courses/testprobs/templates/macros|, |/opt/pg/macros|, |/web/opt/webwork2/libraries/union_problib/macros|, |/web/opt/pg/doc/MathObjects/macros| at line 310 of (eval 1036) Died within main::loadMacros called at line 6 of [TMPL]/probs/prob1.pg

Error details

Problem1
ERROR caught by Translator while processing problem file:probs/prob1.pg
****************
Can't locate macro file |contextIntegerFunctionspl| via path: |.|, |/opt/webwork2/courses/testprobs/templates/macros|, |/opt/pg/macros|, |/web/opt/webwork2/libraries/union_problib/macros|, |/web/opt/pg/doc/MathObjects/macros| at line 310 of (eval 1036)
Died within main::loadMacros called at line 6 of [TMPL]/probs/prob1.pg

****************

------Input Read
1 #DESCRIPTION
2 ##Type of
3 #ENDDESCRIPTION
4
5 DOCUMENT();
6 loadMacros(
7 "PGstandard.pl",
8 "PGchoicemacros.pl",
9 #"PGgraphmacros.pl",
10 "MathObjects.pl",
11 # "compoundProblem.pl",
12 #"contextCurrency.pl",
13 #"contextInequalities.pl",
14 #"unionTables.pl",
15 # "unionLists.pl",
16 #"unionMacros.pl",
17 #"contextLeadingZero.pl",
18 #"contextFraction.pl",
19 "answerHints.pl",
20 "problemPanic.pl",
21 contextIntegerFunctions.pl, #for C(n,r), P(n,r)
22 #PGauxiliaryFunctions.pl, #for lcm, gcd,etc
23 );
24 #for currency use Context("Currency") then Currency($A);
25 #Then, in the text use $DOLLAR $a
26 TEXT(beginproblem());
27 $showPartialCorrectAnswers = 1;
28 Context("Numeric");
29 $a=random(3,5,1);
30 $ans=C(10,$a);
31
32
33 BEGIN_TEXT
34 How many ways can $a CD's be chosen from a case of 10 CDs?
35 \{ans_rule(5)\}
36 SPAR
37 \{Panic::Button(label => " Ask for a Hint", penalty => .00)\}
38 END_TEXT
39 ANS(Real($ans)->cmp);
40
41 ENDDOCUMENT()
42
43
44 END_TEXT
45 if ($panicked) {
46 BEGIN_TEXT
47 Hint:
48 END_TEXT
49 };
50 BEGIN_TEXT
51 $PAR

-----

Request information
In reply to Kenneth Appel

Re: path to context?

by Davide Cervone -
You have left off the quotation marks, so that contextIntegerFunctions.pl becomes the two string constants "contextIntergetFunction" and "pl" combined by the dot operation, which is string concatenation, and so you get "contextIntegerFunctionspl", with no dot. Notice that that is the filename that appears in the error message.

Davide

PS, if the penalty in a Panic::Button is 0, you don't need to specify it as the default is 0.

PPS, note that contextIntegerFunctions.pl is needed only if you want the STUDENT to be able to enter C(n,m) and P(n,m) in their answers. If you only need them for the author, they are already part of PGauxiliaryFunctions.pl, which is loaded automatically by PGstandard.pl. If you want the students to compute the numeric values of these functions, don't use contextIntegerFunctions.pl.