Marking fails throwing perl error

Added by Matthew Leingang about 6 years ago

Hi, I am using a new installation of AMC (1.3.0+hg2017-10-25) and having an issue marking my quiz. When I press Mark on the Marking tab and watch the log, I can see each sheet being compiled through TeX. But then shortly after, and before any scoring happens, I get this error:

Can't call method "set_type" on an undefined value at /opt/local/lib/perl5/vendor_perl/5.26/AMC/Scoring.pm line 183.

Then the marking stops with no marks recorded.

That line is in the middle of this method:

#######################################################
# small methods to relay to embedded ScoringEnv object

sub set_type {
  my ($self,$type)=@_;
  return($self->{env}->set_type($type));
}

So env isn't getting set for some reason. What am I doing wrong?

I'm attaching the log file in case it helps. Thanks in advance.


Replies (30)

RE: Marking fails throwing perl error - Added by Matthew Leingang almost 6 years ago

I found it: it's in /opt/local/share/texmf-local/tex/latex/AMC/.

I will see if using the updated style file changes anything.

RE: Marking fails throwing perl error - Added by Matthew Leingang almost 6 years ago

OK, it looks like I have AMC 1.3 working! My issues may have been related to the outdated automultiplechoice.sty file that I was using. And it may also have been related to the fact that I was using the MacTeX TeX Live distribution but had not enabled the +mactex variant for the port.

Here is what I did, in case it helps anyone else. I wanted to start from scratch, so I removed all ports:

sudo port uninstall installed

then uninstalled MacPorts, then reinstalled. (NOTE: It may be smarter to cache the list of installed ports, for restoring later on, as in MacPorts Migration)

To use the +mactex variants, the MacTeX binaries need to be visible to MacPorts. So I had to edit the MacPorts config file as in Installing AMC with MacPorts on macOS.

Then, I ran

sudo port install dblatex +mactex
sudo port install auto-multiple-choice +mactex

The second command might be all one needs. I was having trouble with the first one, but I think it was because I hadn't properly fixed the path as I outlined above.

After that, success!

I finally noticed the errors that you referred to originally about \AMCboxdimensions needing to be called after \begin{document}. I much prefer to leave this kind of code in the preamble. It seems I can get around it by surrounding the line with \AtBeginDocument:

\AtBeginDocument{\AMCboxDimensions{shape=oval,down=1mm}}

RE: Marking fails throwing perl error - Added by Alexis Bienvenüe almost 6 years ago

Great. Thanks for the report.
I'll fix \AMCboxStyle (aka \AMCboxDimensions) so that it can also be used in the preamble, but meanwhile the \AtBeginDocument is a good workaround.

RE: Marking fails throwing perl error - Added by Matthew Leingang over 5 years ago

A few months later I got this error again, and once again came back to this page. This time, it didn't have anything to do with the AMC version or \AMCboxDimensions. I had generated sheets, given the exam, and done the data capture already. I didn't want to regenerate the sheets because I would lose the data capture, and quite possible corrupt the entire process.

The problem was that between generating and marking the sheets, I had changed some included package code that introduced an error into compilation. To figure it out, I cloned the project first so I could preserve a backup. In the cloned version, I tried to regenerate the documents. It wasn't long before I found the error preventing the subject from compiling.

Once I fixed the error in the package code, everything worked fine again. I'm only including this reply because the error message is so cryptic it's hard to guess what would cause it.

RE: Marking fails throwing perl error - Added by Alexis Bienvenüe over 5 years ago

between generating and marking the sheets, I had changed some included package code that introduced an error

Yes: this is quite risky to include from your source file some code that is stored outside the project directory and shared between several projects or tasks. When you update this code for some task or new project, you can brake other ones without realizing it.

« Previous 1 2 (26-30/30)