Forums

Search results: 7

Hi,

After upgrading to version 2.17 some of our problems are no longer rendering properly. The error message isn't clear either (to me at least).

We are using includeRandomProblem to give different students different problems and some of the problems are working while some are not. I've tried comparing them but can't find why there is an issue. Here is the error message with code for the problem included in the error:

       Problem1
1. ERROR caught by Translator while processing problem file:Library/StockholmUni/DifferentialCalculusOneVar/Derivate/001.pg
****************
ERRORS from evaluating PG file: 
ERROR in included file: Library/StockholmUni/DifferentialCalculusOneVar/Derivate/DerivateEasy/enkelt5.pg 'require' trapped by operation mask at /usr/lib/x86_64-linux-gnu/perl/5.26/Encode.pm line 5 Died within Encode::Alias::find_alias called at line 114 of /usr/lib/x86_64-linux-gnu/perl/5.26/Encode.pm from within Encode::getEncoding called at line 132 of /usr/lib/x86_64-linux-gnu/perl/5.26/Encode.pm from within Encode::find_encoding called at line 166 of /usr/lib/x86_64-linux-gnu/perl/5.26/Encode.pm from within Encode::encode called at line 82 of [WW]/lib/Apache/WeBWorK.pm from within (eval) called at line 127 of [PG]/lib/WeBWorK/PG/IO.pm from within WeBWorK::PG::IO::includePGtext called at line 33 of [TMPL]/macros/unionInclude.pl from within main::includePGfile called at line 59 of [TMPL]/macros/unionInclude.pl from within main::includeRandomProblem called at line 7 of (eval 1228) Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl/5.26/Encode/Alias.pm line 22 ################################################################################ # WeBWorK Online Homework Delivery System # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ # $CVSHeader: webwork2/conf/snippets/blankProblem.pg,v 1.2 2005/02/06 15:20:51 gage Exp $ # # This program is free software; you can redistribute it and/or modify it under # the terms of either: (a) the GNU General Public License as published by the # Free Software Foundation; either version 2, or (at your option) any later # version, or (b) the "Artistic License" which comes with this package. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the # Artistic License for more details. ################################################################################ DOCUMENT(); # Load whatever macros you need for the problem loadMacros("PGstandard.pl", "MathObjects.pl", ); ## Do NOT show partial correct answers $showPartialCorrectAnswers = 0; TEXT(beginproblem()); $A = random(1,9,1); BEGIN_TEXT Bestäm derivatan till funktionen \\(f(x) = 1/(x+${A})^2 \\) $PAR$PAR \\( f'(x) = \\) \\{ans_rule(20) \\} $PAR END_TEXT $ans = Compute("-2/(x+${A})**3"); ANS($ans->cmp); ENDDOCUMENT(); at [PG]/lib/WeBWorK/PG/IO.pm line 129
****************
------Input Read 1 DOCUMENT(); 2 3 # Load whatever macros you need for the problem 4 loadMacros("unionInclude.pl", 5 ); 6 7 includeRandomProblem( 8 "DerivateEasy/enkelt1.pg", 9 "DerivateEasy/enkelt3.pg", 10 "DerivateEasy/enkelt4.pg", 11 "DerivateEasy/enkelt5.pg", 12 ); 13 14 ENDDOCUMENT();

I would guess that the file got saved with the name you gave.  The error isn't in the saving, it's in the displaying of the new question.

The question calls the file derivative-text.pg using the code:
Since no path is given, it looks for the file in the same directory as the question itself.  Since you saved the new question in a different directory, it can't find 
derivative-text.pg there.

The fix should be to use the file manager to copy the file derivative-text.pg into the directory Payer/M105_HW_10.


Hello,

I just saved an open Library problem to a local Drive in my webwork course.
I got an error statement without making any changes except for the filename.

The original file path was: 
Library/Union/setDervGraphs/nsc2s10p3.pg
The new name I gave to this file was: 

Payer/M105_HW_10/Overlayed_fprimes.pg

But in the error statement the reply stated that I named the file:

But I did not! What would cause this error?

Thanks, tim
        Problem6
ERROR caught by Translator while processing problem file:Payer/M105_HW_10/Overlayed_fprimes.pg
****************
ERRORS from evaluating PG file: 
/usr/sbin/apache2: read_whole_file subroutine:
Can't read file [TMPL]/Payer/M105_HW_10/derivative-text.pg at [PG]/lib/WeBWorK/PG/IO.pm line 120 Died within WeBWorK::PG::IO::read_whole_file called at line 114 of [PG]/lib/WeBWorK/PG/IO.pm from within WeBWorK::PG::IO::read_whole_problem_file called at line 27 of [TMPL]/Library/macros/Union/unionInclude.pl from within main::includePGfile called at line 78 of (eval 5364)
****************
------Input Read 1 ## DESCRIPTION 2 ## Calculus 3 ## ENDDESCRIPTION 4 5 ## Tagged by tda2d 6 7 ## DBsubject(Calculus - single variable) 8 ## DBchapter(Applications of differentiation) 9 ## DBsection(Summary of curve sketching) 10 ## Date(9/29/08) 11 ## Institution(Union College) 12 ## MLT(SCS_graphs_match) 13 ## MLTleader(1) 14 ## Level(3) 15 ## KEYWORDS('derivatives' 'graph') 16 ## Library/Union/setDervGraphs/nsc2s10p3 17 18 DOCUMENT(); # This should be the first executable line in the problem. 19 20 loadMacros( 21 "PGstandard.pl", 22 "PGunion.pl", # Union College utilities 23 "MathObjects.pl", 24 "unionInclude.pl", # The text for this question is called with includePGfile("derivative-text.pg" 25 "PGchoicemacros.pl", 26 "PGgraphmacros.pl", 27 "PGcourse.pl", # Customization file for the course 28 ); 29 30 TEXT(beginproblem()); 31 32 ################################### 33 # Setup 34 35 $a=random(0, 6.3, .1); 36 $b=random(.7, .9, .1); 37 38 $dom = 4; 39 @slice = NchooseK(3,3); 40 41 @colors = ("blue", "red", "green"); 42 @sc = @colors[@slice]; #scrambled colors 43 @sa = ('A','B','C')[@slice]; 44 45 # define the functions and their derivatives. 46 # FEQ (Format EQuations) cleans up the writing of the functions (see FEQ in PGbasicmacros) 47 # Otherwise we would need to worry about the signs of $a, $b and so forth. 48 49 $f = FEQ("sin($a+$b*cos(x)) for x in <-$dom,$dom> using color:$sc[0] and weight:2"); 50 $fp = FEQ("cos($a+$b*cos(x))*(-$b)*sin(x) for x in <-$dom,$dom> using color=$sc[1] and weight:2"); 51 $fpp = FEQ("-sin($a+$b*cos(x))*$b*$b*sin(x)*sin(x)+ cos($a+$b*cos(x))*(-$b)*cos(x) for x in <-$dom,$dom> using color=$sc[2] and weight=2"); 52 53 $graph = init_graph(-4,-4,4,4,'axes'=>[0,0],'grid'=>[8,8],'size'=>[300,300]); 54 55 ($fRef,$fpRef,$fppRef) = plot_functions( $graph, 56 $f,$fp,$fpp 57 ); 58 59 # create labels 60 61 $label_point=-1; 62 $label_f = new Label ( $label_point,&{$fRef->rule}($label_point),$sa[0],"$sc[0]",'left') ; 63 # NOTE: $fRef->rule is a reference to the subroutine which calculates the 64 # function. It was defined in the output of plot_functions. It is used here 65 # to calculate the y value of the label corresponding to the function, 66 # and below to find the y values for the labels corresponding to the 67 # first and second derivatives. 68 69 $label_fp = new Label ( $label_point+.5,&{$fpRef->rule}($label_point+.5),$sa[1],"$sc[1]",'left') ; 70 $label_fpp = new Label ( $label_point+1,&{$fppRef->rule}($label_point+1),$sa[2],"$sc[2]",'left'); 71 72 # insert the labels into the graph 73 $graph->lb($label_f,$label_fp,$label_fpp); 74 75 ################################### 76 # Main text 77 78 includePGfile("derivative-text.pg"); 79 80 ################################### 81 # Answers 82 83 $showPartialCorrectAnswers = 0; 84 ANS(str_cmp( [ @sa ] ) ); 85 86 ################################### 87 88 89 ; 90 ENDDOCUMENT(); -----
> Undefined subroutine &main::read_whole_problem_file called at [PG]/macros/PG.pl

We have had the same problem, but it appeared to be consistent rather than sporadic. To remedy it, we would update all the problems to the actual source problem, rather than the redirection:

- Open each homework set in HWSet Editor.
- Display all the problems.
- For each problem that had an error in when displaying,
- "Edit it" - this opens a new tab and shows the source with the includePGfile command.
- Select and copy the actual source file .pg name.
- Tab back to the homework set and paste the redirect target over the original .pg path.
- Save.
[then check the homework set again: sometimes the historic redirections were 3-5 deep!]

Removing these includePGfile references has eliminated the &main::read_whole_problem_file errors we were getting. The downside is obviously that it can be a fair amount of work.

If you are comfortable writing scripts, it might be more efficient to extract the .def files, grep for includePGfile in each of them and either do the substitutions with the script, or at least automate the indification of the files at issue. Alternatively, we could try to figure out why includePGfile isn't working as it used to. :)

Alan




"upgrading" to Ubuntu 14.04 LTS with the Apache 2.4.7 has caused us many problems. So far we have fixed most of them by changing to the development branch of webwork 2.9, and upgrading everything. But there is one problem that just never goes away:

The function read_whole_problem_file fails erratically. Sometimes it works for a while, sometimes it doesn't, sometimes rebooting the web server cures the problem, sometimes it doesn't. This is a big headache because the problem database includes many links from one file to another, apparently to reduce the number of duplicates, but this seems to depend on read_whole_problem_file working reliably.

Here is an example of that type of error.

ERROR caught by Translator while processing problem file:rochesterLibrary/setInt
egrals15ByParts/bennyparts1.pg
****************
ERRORS from evaluating PG file:
Undefined subroutine &main::read_whole_problem_file called at [PG]/macros/PG.pl
line 661
Died within main::includePGproblem called at line 10 of (eval 1760)



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

------Input Read
1 # This file is just a pointer to the file
2 #
3 # "Library/Union/setIntByParts/bennyparts1.pg"
4 #
5 # You may want to change your problem set to use that problem
6 # directly, especially if you want to make a copy of the problem
7 # for modification.
8
9 DOCUMENT();
10 includePGproblem("Library/Union/setIntByParts/bennyparts1.pg");
11 ENDDOCUMENT();
12
13 ## These tags keep this problem from being added to the NPL database
14 ##
15 ## DBsubject('ZZZ-Inserted Text')
16 ## DBchapter('ZZZ-Inserted Text')
17 ## DBsection('ZZZ-Inserted Text')

-----

Here is an example of a similar error that doesn't seem to be caused by
links to a duplicate problem

ERROR caught by Translator while processing problem file:Library/Union/setIntRie
mannSums/an6_4_34_left.pg
****************
ERRORS from evaluating PG file:
Undefined subroutine &main::read_whole_problem_file called at line 27 of [TMPL]
/Library/macros/Union/unionInclude.pl
Died within main::includePGfile called at line 45 of (eval 1023)



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

------Input Read
1 ## DESCRIPTION
2 ## Calculus: Riemann Sums
3 ## ENDDESCRIPTION
4
5 ## Tagged by cmd6a 8/9/06
6
7 ## DBsubject(Calculus - single variable)
8 ## DBchapter(Techniques of integration)
9 ## DBsection(Approximation)
10 ## Date(8/23/07)
11 ## Institution(Union College)
12 ## Author(K. Lesh)
13 ## MLT(approx_02)
14 ## Level(2)
15 ## MO(1)
16 ## TitleText1('Calculus')
17 ## AuthorText1('Anton')
18 ## EditionText1('7')
19 ## Section1('6.4')
20 ## Problem1('34')
21 ## TitleText2('Calculus: Early Transcendentals')
22 ## AuthorText2('Rogawski')
23 ## EditionText2('1')
24 ## Section2('5.1')
25 ## Problem2('19')
26 ## KEYWORDS('calculus','integration','riemann sums')
27
28 DOCUMENT(); # This should be the first executable line in the problem.
29
30 loadMacros(
31 "PGstandard.pl",
32 "PGunion.pl", # Union College utilities
33 "MathObjects.pl",
34 "unionInclude.pl", # Utilities for included files
35 "PGcourse.pl", # Customization file for the course
36 );
37
38 TEXT(beginproblem());
39
40 ###################################
41 # Setup
42
43 # The following file defines the function to be used
44
45 includePGfile("an6_4_34-define-function-text.pg");
46
47 # $offset (if present) is a number between 0 and 1 that
48 # indicates where within each interval, the point should
49 # be taken. E.g., 0 = left-end, .5 = midpoint, 1 = right-end.
50 # The default is 0.
51
52 $offset = 0; #use left endpoints
53
54 ###################################
55 # Main text
56
57 #The following file generates the problem text for each
58 #Riemann sum estimate.
59
60 includePGfile("riemann-sum-estimate-text.pg");
61
62 ###################################
63 # Answers
64
65 $showPartialCorrectAnswers = 1;
66
67 #The $ans is included from the files above
68
69 ANS(Real($ans)->cmp);
70
71 ###################################
72
73
74 COMMENT('MathObject version');
75 ENDDOCUMENT();

-----

Is there a fix for this or should we just dump Ubuntu 14.04 and apache2.4 and rebuild the server with something else?

Thanks for any help you can give,

George
--
George Jennings, Math Dept., Calif. State University, Dominguez Hills


I'm not 100% sure of this but I think that might be a legacy file which 
was read into one of the problems in the set with setup information that
was specific to Union College (where this orientation was first written).  I suspect that the Union College specific aspects of the set were removed
but the external file was not discarded.  I believe that includePGfile() allows you to read in external files.  This was included in the unionInclude.pl macro files which is at NationalProblemLibrary/macros/Union.

A similar function  includePGproblem($filePath) is also available. It is defined in pg/macros/PG.pl

Davide Cervone could tell you the original purpose of the file. Arnie Pizer might also have some information since he recently reorganized the setOrientation collection.

Hope this helps.

-- Mike

Davide,
Thought I should let you know about this. When I changed my version of contextInequalitiesAllowStrings.pl to allow for answers like "No solution" for the empty set, I could not get it to work by "redefining" the constants. I got this error message:

ERROR in included file: Problems/setAlgebra_04_02_CompoundIneq/42IntAlg_03_CompoundIneq.pg No definition for constant 'NONE' in the given context at line 51 of [TMPL]/macros/contextInequalitiesAllowStrings.pl Died within main::_contextInequalitiesAllowStrings_init called at line 332 of (eval 232) from within main::loadMacros called at line 20 of [TMPL]/Problems/setAlgebra_04_02_CompoundIneq/42IntAlg_03_CompoundIneq.pg from within (eval) called at line 86 of [PG]/lib/WeBWorK/PG/IO.pm from within WeBWorK::PG::IO::includePGtext called at line 32 of [TMPL]/macros/unionInclude.pl from within main::includePGfile called at line 56 of [TMPL]/macros/unionInclude.pl from within main::includeRandomProblem called at line 15 of [TMPL]/Problems/setAlgebra_04_02_CompoundIneq/42aRandomizer_Problems_03_to_07.pg

However, when I used the second of your suggestions -- where the constant was added -- it worked as desired.

I was wondering why the error happened when I used the "redefine" method.
--rac