It's me again with strange symptoms (WL 11.0 / Windows 10 / native command line)... I have this piece of code that reads the NIST randomness beacon:
First[Cases[Import["https://beacon.nist.gov/rest/record/"<>ToString[UnixTime[]],"XML"],XMLElement["outputValue",{},{x_}]:>x,Infinity]]
The code works just fine in a notebook and returns a string with the current random number, which looks like this:
"60872A7889BE4EF63E00D84610C5098E6D4696C262C02ADA3CAD4A886E7B1FF2F95A713F6450FA6E2E816932E7E276E3E639517BEE4137D28D8449C9008BB7F5"
So far, so good. Now consider the following two scripts; the first one contains the code I actually want to run:
"beacon.wl":
#!wolframscript
Print[First[Cases[Import["https://beacon.nist.gov/rest/record/"<>ToString[UnixTime[]],"XML"],XMLElement["outputValue",{},{x_}]:>x,Infinity]]]
The second script contains separate tests of everything that happens, i.e. converting UnixTime
to a string, doing a StringJoin
with that and another string, and finally importing the results from the NIST website for a pre-determined time:
"test.wl":
#!wolframscript
Print[ToString[UnixTime[]]];
Print[ToString[UnixTime[]]<>"moo!"];
Print[First[Cases[Import["https://beacon.nist.gov/rest/record/1472807495","XML"],XMLElement["outputValue",{},{x_}]:>x,Infinity]]];
And here's what happens when I run both script files on the local kernel vs. on the cloud kernel:
It seems as though the beacon script and tests all work locally, the tests also work in the cloud, but the cloud kernel doesn't like the complete code for some reason. I could probably circumvent the problem with an API call, but I'd rather understand what's going on here so that I can avoid (or at least anticipate) the issue in the future. Any ideas? The -v
option wasn't helpful. An Evaluate
around the StringJoin
didn't change anything either.