Group Abstract Group Abstract

Message Boards Message Boards

WolframScript: Compute in the cloud, export results locally?

POSTED BY: Bianca Eifert
3 Replies

Thank you both for the answers!

The output redirection indeed works fine without the quotes, and more importantly, it also works on a script file:

wolframscript -o -f test.wl -format PNG > file.png

where the last line of the script file is a Print of whatever plot I want. That's pretty cool. Seems like it was really just a Windows issue.

Your CloudEvaluate-and-copy approach also works. However, I had some hope that there'd be a standalone wolframscript installer soon which would allow us to run code on machines that do not have a local WL kernel. (Maybe even with a portable executable that doesn't require admin access, that would be really awesome.) I'm not trying to skimp on the license, but it's just not always possible or practical.

David - that's a valid point about the cloud credentials, especially with the all-purpose Wolfram account (where the same credentials will get you into the user portal and this forum and all the other cloud services as well). Maybe a second dummy account would help, but I have a feeling that that's very much not encouraged... For what it's worth, the stored credentials on my computer look encoded at first glance.

Anyway, wolframscript is still awesome for use with a local kernel, I really apprectiate the addition. I like the frontend as much as the next person, but sometimes scripts are just so much more convenient.

POSTED BY: Bianca Eifert

I don't think there will be any way to send the output from the cloud to your machine. A possible workaround is to run your script locally, but have it call CloudEvaluate. Here's my script that does this, and then copies the file from the cloud to my local machine. Not beautiful, but it works.

#!wolframscript
CloudConnect["chadk@wolfram.com","xxxx"];
CloudEvaluate[Export[CloudObject["testplot.png"],Graphics3D[Sphere[]],"PNG"]];
CopyFile[CloudObject["testplot.png"],"localttestplot.png"];
Print["all done!"];

Or you could have a 2nd script that calls CopyFile the output from your first script. But that seems even worse.

I also can reproduce the Windows issue. For some reason the single quotes don't work in Windows. If you open the png file with a text editor, you'll see an error message: ToExpression::sntx: Invalid syntax in or before "'Graphics3D[Sphere[]]'". It works without the single quotes:

wolframscript -code Graphics3D[Sphere[]] -format PNG > file.png

Note: note space between the brackets.

POSTED BY: Chad Knutson
Posted 9 years ago

I was able to get a correct output using both local and cloud forms on OS X 10.10.5 Mathematica 11.0:

wolframscript -code 'Graphics3D[Sphere[ ]]' -format PNG > file.png
wolframscript -cloud -code 'Graphics3D[Sphere[ ]]' -format PNG > file.png

I am not sure how to pass Wolfram cloud credentials without typing them however, this seems problematic for using wolframscript in many cases....

POSTED BY: David Proffer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard