ERROR in contacting sage server. Did you accept the terms of service by
setting {accepted_tos=>'true'} in the askSage options?
IO.pm: ERROR trapped during JSON call to sage:
Unable to make a sage call to https://sagecell.sagemath.org/service. at [PG]/lib/WeBWorK/PG/IO.pm line 344
Died within WeBWorK::PG::IO::AskSage called at line 770 of [PG]/lib/PGcore.pm
from within PGcore::AskSage called at line 149 of [PG]/macros/PG.pl
from within main::AskSage called at line 12 of (eval 791)
at [PG]/lib/WeBWorK/PG/IO.pm line 399
DOCUMENT(); loadMacros(
"PGstandard.pl", # Standard macros for PG language
);
TEXT(beginproblem());
$SageCode=<<END;
print 'This is a string.'
END
$sageReply = AskSage($SageCode,{accepted_tos=>true,debug=>'1',seed=>$problemSeed});
BEGIN_TEXT
$sageReply
END_TEXT
ENDDOCUMENT();
I get the following error:
debug is turned on in IO.pm. at [PG]/lib/WeBWorK/PG/IO.pm line 267
IO::query_sage_server(): SAGE CALL: /usr/bin/curl -i -k -sS -L --data-urlencode "accepted_tos=true" --data-urlencode 'user_expressions={"WEBWORK":"_webwork_safe_json(WEBWORK)"}' --data-urlencode "code=set_random_seed(1234)
WEBWORK={}
def _webwork_safe_json(o):
import json
def default(o):
try:
if isinstance(o,sage.rings.integer.Integer):
json_obj = int(o)
elif isinstance(o,(sage.rings.real_mpfr.RealLiteral, sage.rings.real_mpfr.RealNumber)):
json_obj = float(o)
elif sage.modules.free_module_element.is_FreeModuleElement(o):
json_obj = list(o)
elif sage.matrix.matrix.is_Matrix(o):
json_obj = [list(i) for i in o.rows()]
elif isinstance(o, SageObject):
json_obj = repr(o)
else:
raise TypeError
except TypeError:
pass
else:
return json_obj
# Let the base class default method raise the TypeError
return json.JSONEncoder.default(self, o)
return json.dumps(o, default=default)
print 'This is a string.'" https://sagecell.sagemath.org/service
RETURN from sage call
HTTP/2 200
date: Sat, 23 Sep 2017 13:48:48 GMT
content-type: application/json; charset=UTF-8
content-length: 221
set-cookie: __cfduid=d9605e2e52cb8b328ab8364f7f4725a2b1506174527; expires=Sun, 23-Sep-18 13:48:47 GMT; path=/; domain=.sagemath.org; HttpOnly
vary: Accept-Encoding
server: cloudflare-nginx
cf-ray: 3a2df6ada8d76349-FRA
{"execute_reply": {"status": "ok", "execution_count": 1, "user_expressions": {"WEBWORK": {"status": "ok", "data": {"text/plain": "'{}'"}, "metadata": {}}}, "payload": []}, "success": true, "stdout": "This is a string.\n"}
END SAGE CALL at [PG]/lib/WeBWorK/PG/IO.pm line 270
ERROR in contacting sage server. Did you accept the terms of service by
setting {accepted_tos=>'true'} in the askSage options?
IO.pm: ERROR trapped during JSON call to sage:
Unable to make a sage call to https://sagecell.sagemath.org/service. at [PG]/lib/WeBWorK/PG/IO.pm line 344
Died within WeBWorK::PG::IO::AskSage called at line 770 of [PG]/lib/PGcore.pm
from within PGcore::AskSage called at line 149 of [PG]/macros/PG.pl
from within main::AskSage called at line 12 of (eval 791)
at [PG]/lib/WeBWorK/PG/IO.pm line 399
My impression is that the problem occurs in pg/lib/WeBWorK/PG/IO.pm around lines 282-293. Just above these lines there are sample values for $continue, $header and $content. Debugging on my installation I could not reproduce these values. Maybe this due to a change with
sagecell.sagemath.org
. The comments in IO.pm show "TornadoServer/3.1", while I see "cloudflare-nginx". Maybe something in the HTTP response changed and IO.pm is not parsing it correctly anymore. Can anybody reproduce this problem?