I
am having a weird problem. insertGraph isn't working. It creates an
empty png file but doesn't make the graph. There are now errors as
well. Equations are working fine.
The example page we are using has two graphs. When click on the problem
to load the page. I get the generic error (Safari is my browser):
Safari canât open the page âhttp://servername/webwork2/COURSEID/Final_Exam_Review_VII/1â¦O2hNhbU1XQ8CDg&user=Professor&effectiveUser=Professorâ because it could not load any data from this location.
it does this three times (or until it makes three empty png's) and then it loads the page with the empy images.
I tried to do some debugging and this is as far as I got:
[modified dangerousMacros.pl]
sub insertGraph {
# Convert the image to GIF and print it on standard output
my $graph = shift;
my $extension = ($WWPlot::use_png) ? '.png' : '.gif';
my $fileName = $graph->imageName . $extension;
my $filePath = convertPath("gif/$fileName");
$filePath = &surePathToTmpFile( $filePath );
# Check to see if we already have this graph, or if we have to make it
warn("$0",testing,"");
my $filePathlog = $filePath . ".log";
local(*OUTPUTLOG); # create local file handle so it won't overwrite other open files.
open(OUTPUTLOG, ">$filePathlog")||warn ("$0","Can't open $filePathlog ","");
print OUTPUTLOG "filepath = $filePath, imagename = ",$graph->imageName , "stat = ", (stat $filePath)[9];
if( not -e $filePath # does it exist?
or ((stat "$templateDirectory"."$main::envir{fileName}")[9] > (stat $filePath)[9]) # source has changed
or $graph->imageName =~ /Undefined_Set/) { # problems from SetMaker and its ilk should always be redone
#createFile($filePath, $main::tmp_file_permission, $main::numericalGroupID);
print OUTPUTLOG "\ninside\n";
local(*OUTPUT); # create local file handle so it won't overwrite other open files.
open(OUTPUT, ">$filePath")||warn ("$0","Can't open $filePath ","");
chmod( 0777, $filePath);
print OUTPUT $graph->draw|| warn("$0","Can't print graph to $filePath ","");
close(OUTPUT)||warn("$0","Can't close $filePath ","");
close(OUTPUTLOG);
}
$filePath;
}
which outputs three testing
lines (one for each graph) in the web browser and:
filepath =
/usr/local/webwork2/courses/COURSEID/html/tmp/gif/professor-463-setFinal_Exam_Review_VIIprob1image1.png,
imagename = professor-463-
setFinal_Exam_Review_VIIprob1image1stat = inside
in each log file
Let me know if you require any more details. Thanks,
Bjorn
bnelson@baruch.cuny.edu
<| Post or View Comments |>
|