WeBWorK Problems

Webwork Warning when using HINT

Webwork Warning when using HINT

by Stefania Tracogna -
Number of replies: 5

We just installed a new version of webwork this summer. Whenever a problem contains a HINT a pink screen appears with the following webwork warning.

Warning messages

  • Use of uninitialized value in numeric le (<=) at /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm line 637.

The coding for the HINT is the following:

$showHint=1;

HINT(EV2(<<EOH));
This is the hint.
EOH

The problems work fine on another server (with an older version of webwork).The file PGbasicmacros.pl is the same on the two servers. The pink screen disappears after an answer is checked or if the lines with HINT are commented out.

Any help would be appreciated.

Stefania


In reply to Stefania Tracogna

Re: Webwork Warning when using HINT

by Gavin LaRose -
Hi Stefania,

Is it correct to assume that you're running WeBWorK 2.4-patches as your new version?

Looking at the code, it appears that this is probably an error with some problems not having a fully initialized environment. The line in question (637 in Problem.pm) is (if the line numberinf is right) in the if_errors() subroutine,
 sub if_errors($$) {
my ($self, $arg) = @_;

if ($self->{isOpen}) {
return $self->{pg}->{flags}->{error_flag} ? $arg : !$arg;
} else {
return !$arg;
}
}

I'm not seeing where the numeric comparison is showing up there, unless the test of $self->{flags}->{error_flag} is implicitly a numeric test. (That line is line 637.)

I'm hoping that this will inspire someone else with somewhat better knowledge of the PG flags to add to this thread. :)

Gavin
In reply to Gavin LaRose

Re: Webwork Warning when using HINT

by Stefania Tracogna -
Hi Gaving,
actually it seems we are using webwork 2.3.2.

This is what line 637 in Problem. pm sasy:
line 637 in Problem.pm

$can{showHints} &&= $pg->{flags}->{hintExists}
&&= $pg->{flags}->{showHintLimit}<=$pg->{state}->{num_of_incorrect_ans};
$can{showSolutions} &&= $pg->{flags}->{solutionExists};


I hope this will help figuring out what is wrong.

Thanks,

Stefania
In reply to Stefania Tracogna

Re: Webwork Warning when using HINT

by Davide Cervone -
I am not able to reproduce the problem. I tried it on a 2.3.1 installation (I didn't have time to set up 2.3.2 installation), as well as 2.4.5, and don't get the error in either case. Do the problems you are trying out install a grader (using install_problem_grader)?
What is $pg{options}{grader} set to in your global.conf?

Could you post a reference to a specific problem so I can try that one out?

The reason that I'm asking about the grader is because that is what sets the $pg->{state}->{num_of_incorrect_ans}, and I suspect that is the one that is not being set properly. It may be that the state is not being initialized properly, so on the first time through (when there is no answer to be checked yet), the grader hasn't given a value to num_incorrect_ans, but then after the first answer is given, that value is set by the grader.

Davide
In reply to Davide Cervone

Re: Webwork Warning when using HINT

by Stefania Tracogna -
Hi Davide,
the problems I am trying out do not install a grader. I tried several
problems from the library and I get the pink scree and webwork warning in ALL the ones
using HINT.
Here are some examples:

Library/Rochester/setTrig03FunctionsRightAngle/p4.pg

Library/Rochester/setTrig03FunctionsRightAngle/p5.pg
Library/270/setDerivatives9Approximations/c2s9p8.pg

The pg{option}{grader} in global.conf is the default one:

# The default grader to use, if a problem doesn't specify.
$pg{options}{grader} = "avg_problem_grader";

Stefania
In reply to Stefania Tracogna

Re: Webwork Warning when using HINT

by Davide Cervone -
I'm afraid I still haven't been able to reproduce your problem. I tried updatig my 2.3.1 to a 2.3.2 installation, and still no problems with hints for me. Is you copy of PG also at 2.3.2?

Does the error occur in the Library Browser, or in problems actually assigned to a homework set, or both?

Davide