WeBWorK Main Forum

Header errors

Header errors

by Lars Jensen -
Number of replies: 5

Hi Everyone,

When printing a set I sometimes get an error:

1 error occured while generating hardcopy:

[edit] Errors encountered while processing snippet 'defaultHeader' for set 'set03' and user 'jensen'. This snippet has been omitted from the hardcopy. Error text:
Failed to read the problem source file.

Other sets that are set up with exactly the same defaultHeader doesn't produce this error. (What is defaultHeader, by the way - I don't see the file anywhere)

When I open these sets in the Hmwk Sets Editor and display the headers, I see the errors below, whether the error above occurs up or not.

WeBWorK::Utils::readFile(/opt/webwork/courses/m285_jensen/templates/defaultHeader) says: failed to read file /opt/webwork/courses/m285_jensen/templates/defaultHeader: No such file or directory at /opt/webwork/webwork2/lib/WeBWorK/Utils.pm line 160.

Any ideas what is going on, and how to get rid of the errors?

Thanks,
Lars.

In reply to Lars Jensen

Re: Header errors

by Michael Gage -
the defaultHeader usually points to the setHeader.pg file in the webwork2/conf/snippets directory. (I believe you can set this in global.conf.)

This problem is a minor bug in initialization -- here's a work around -- in the homework set you set defaultHeader to some other header, save it, then reset to defaultHeader and save again the path to the defaultHeader file should be properly initialized. (It has worked for me at least.) I think maybe just saving the homework setup from the hmwk editor might be enough to correct the path.

My suspicion is that the path to the defaultHeader is not being properly initialized when one of the methods for creating a new homework set is used -- I'm not sure which one yet.

If you set the header to be some local setHeader file of your own then you certainly won't have any problems. You can make a local version of the file in snippets.



In reply to Michael Gage

Re: Header errors

by Lars Jensen -
Hi Mike,

Thanks for the reply.

Your first suggestion didn't work for me.

Is there an appropriate setHeader file for a hardcopy that ships with the webwork distribution?

The setHeader.pg file in conf/snippets is not really appropriate for a hardcopy. I understand that I can edit the file, which I'll do. But it would be nice if webwork had a default screenHeader and a hardcopy header file included with the distribution that don't require any editing. Basically all the hardcopy header needs is the due date, set number, and perhaps the course name. The setHeader.pg file has a link to the course webpage (which may not exist) plus info like: "This file is /conf/snippets/setHeader.pg you can use it as a model for creating files which introduce each problem set."

Thanks again,
Lars.
In reply to Lars Jensen

Re: Header errors

by Dick Lane -
I have been experimenting with revisions to setHeader.pg in modelCourse which is propagated to all of its children. My current version (attached) displays a single line in printable (PDF) output but a more extensive DueDate + info + homily + Link for a screen display.

Although I usually create a header document for each of my assignments, there are occasions when I would be satisfied to "punt" with a boilerplate statement. Furthermore, I do not always have major differences between prose for a printable version versus an online version. Nonetheless, I see some advantages to have a "snippets" document with remarks addressed to an instructor during a setup process.

In any event, I do not think a simple use of the Library Browser to create an assignment should result in errors because of an non-existent default header.

I suggest
1) an option in CourseConfiguration to specify a (polymorphic) file to be used as header for both print and screen
2) creation of a single corresponding descriptor for a DEF file (as opposed to having duplicate entries for paperHeader & screenHeader).
In reply to Dick Lane

Re: Header errors

by Dick Lane -
My previous attachment has a TeX section with (5 lines):
        $studentName
\hfill
        WeBWorK assignment $setNumber is due $formattedDueDate.
\hfill
        \{protect_underbar($courseName)\} $sectionNumber}


Since it is valid to have an assignment whose name (the text seen by students) includes an underscore character, I think it will be much safer if such boilerplate resembles (6 lines)
        \{protect_underbar($studentName)\}
\hfill
        WeBWorK assignment \{protect_underbar($setNumber)\}
        is due $formattedDueDate
\hfill
        \{protect_underbar($courseName)\} $sectionNumber}


partial clarification (I hope ;-): although the system variable is named "$setNumber", its value is the string used for the assignment's name (and "$setName" might be a better name).
In reply to Lars Jensen

Re: Header errors

by Arnold Pizer -
Hi Lars et all,

I think all the bugs associated with the new defaultHeader set up have now been squashed.  An svn update is required.

In addition there are three new header files:

ASimpleCombinedHeaderFile.pg
ASimpleHardCopyHeaderFile.pg
ASimpleScreenHeaderFile.pg 

which are in the modelCourse templates directory (in courses.dist).  They will give simple headers without errors.  They also have instructions for simple edits (e.g. uncommenting a line will provide section names for courses with sections or uncommenting a line and an easy edit will add a course URL).  

The list of available header files in the drop down list in the Hmwk Sets Editor is now alphabetized, so these three files appear at the top right below "Use default header".  Since they are in the templates directory (assuming they are placed in the templates directory of the active modelCourse and the new course is based on the modelCourse as is the standard practice), the instructor has permission to edit them.  

The default header files (defined in global.conf) are still set to the "standard" file that needs editing.  However, commented out lines there set these to
ASimpleHardCopyHeaderFile.pg and ASimpleHardCopyHeaderFile.pg so it is easy to switch.  Actually I'll set up the upcoming live DVD distribution to do this.

Arnie