WeBWorK Main Forum

Loading Macros locally

Loading Macros locally

by James Mc Laughlin -
Number of replies: 6
As I wrote in an earlier post, our version of WebWork has not been updated in over 6 years (the person who deals with it has said it will happen over the winter break).

One effect is, that as far as I can tell, we don't have the PGML.pl macro locally.

Some of the problems I find on github load this macro, amongst others, for example:

loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGML.pl",
"PGcourse.pl"
);

I found a copy of this PGML.pl file online at github and tried saving it into the macros/ folder for the course, but I still get a message "This problem produced an error" .

Is there something else I need to do, maybe somehow include a path to the PGML.pl file?

Thanks,

Jimmy
In reply to James Mc Laughlin

Re: Loading Macros locally

by Davide Cervone -
PGML is pretty complicated and has very close hooks into PG itself. It may be using aspects of PG that are not available in your older copy of PG, so even though you have now provided the PGML.pl, it is incompatible with the version of PG you are running.

Perhaps an older version of PGML.pl would work for you. Try this one and see if that does it. (Use the "raw" button to get an un-annotated version, and save it to PGML.pl on disk, then download to your server.) Note, however, that features have been added to PGML over time, and so if the problems you are trying to use contain any of the, they might not work properly.
In reply to Davide Cervone

Re: Loading Macros locally

by James Mc Laughlin -
Davide,

That old version of PGML.pl worked, at least for the one problem I tried it on.

Thanks for the link and the suggestion.

Jimmy.
In reply to James Mc Laughlin

Re: Loading Macros locally

by Michael Gage -
The error message reads as if you are reading it through the library browser.

Try putting the problem in a sample homework set. You may get a more complete error message in that case.

For testing purposes in one course you can put the PGML.pl macro in the
templates/macros directory (in your course). You can do this with the File Manager

If it works there you can also ask someone to place it in the directory

webwork/pg/macros

where it will be available to all courses. They will need commandline access to the server in order to do this.


In reply to Michael Gage

Re: Loading Macros locally

by James Mc Laughlin -
I do have it in the templates/macro folder.

I tried your suggestion of adding it to a problem set, and I did get a more detailed error message (but unfortunately am pretty much clueless about interpreting it :-) ):

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

Error detected while loading [PG]/macros/contextTypeset.pl: PG_macro_file_eval detected error at line 246 of file [PG]/lib/PGloadfiles.pm Can't call method "copy" on an undefined value at line 753 of (eval 34527), chunk 1. The calling package is PGloadfiles Died within PGloadfiles::compile_file called at line 334 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 418 of [PG]/macros/PG.pl from within main::loadMacros called at line 1468 of (eval 34521) from within main::_PGML_init called at line 360 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 418 of [PG]/macros/PG.pl from within main::loadMacros called at line 17 of (eval 34369)

Error details

 Problem11 ERROR caught by Translator while processing problem file:local/setcombinatorics/BallyGoBackDeans_OPL.pg **************** Error detected while loading [PG]/macros/contextTypeset.pl: PG_macro_file_eval detected error at line 246 of file [PG]/lib/PGloadfiles.pm Can't call method "copy" on an undefined value at line 753 of (eval 34527),  chunk 1. The calling package is PGloadfiles Died within PGloadfiles::compile_file called at line 334 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 418 of [PG]/macros/PG.pl from within main::loadMacros called at line 1468 of (eval 34521) from within main::_PGML_init called at line 360 of [PG]/lib/PGloadfiles.pm from within PGloadfiles::loadMacros called at line 418 of [PG]/macros/PG.pl from within main::loadMacros called at line 17 of (eval 34369)
In reply to James Mc Laughlin

Re: Loading Macros locally

by Michael Gage -
There is probably
something wrong with contextTypeset.pl. It might be missing
or the copy that you have may be
incompatible with the version of PG and PGML that you are running. The error
message doesn't give much more information than that.

Davide is right that there are a lot of interactions between PG and PGML and it is not guaranteed that you can get new versions of PGML.pl to run on a 6 year old copy of PG. It will certainly require some trial and error. The next step would be to investigate whether a copy of contextTypeset.pl exists (and/or import a recent copy from git to templates/macros) and see what happens next.
In reply to Michael Gage

Re: Loading Macros locally

by James Mc Laughlin -
Michael,

I downloaded a copy of contextTypeset.pl and uploaded into the course templates/macros folder and the original PGML.pl macro I had worked with that.

Thanks for the help.

Jimmy