4
$\begingroup$

I have a code written in Mathematica. What I am trying to do is to write a wrapper (say using Python) that will take user input for the Mathematica code, run the code, and create output.

I do not want the Mathematica code to be seen by the user while it is being run.

The idea is that user just clicks on an executable, Mathematica code runs in the background, asks user for some input parameters, and generates output.

How can I do that? Which utilities can I use?

$\endgroup$
  • $\begingroup$ Maybe using python you can run Mathematica from command line ( link ). Have you tried that? Also some functionality is described here $\endgroup$ – K.J. Nov 29 '17 at 19:44
  • $\begingroup$ Create a Wolfram Cloud based API. Very easy to set up and call. $\endgroup$ – user6014 Nov 29 '17 at 20:32
  • $\begingroup$ @K.J. I tried running the code from command line. 1) If I do C:\path\to\code\code.m This opens a Mathematica session and runs the code. But the code is visible to the user. This is not desired. 2) I tried C:\path\to\code\wolframscript -code code.m This throws an error: " 'wolframscript' is not recognized as an internal or external command, operable program or batch file." $\endgroup$ – CuriousCoder Nov 29 '17 at 20:34
  • $\begingroup$ @user6014 Cloud based API is not a desired way to go for me. I am assuming that the code would reside in the cloud in this approach. The code needs to reside on a local machine for my purpose. $\endgroup$ – CuriousCoder Nov 29 '17 at 20:41
  • $\begingroup$ You can set up a local HTTP server in the way that I outline here. It would be like working against the cloud, except your API would be run locally. $\endgroup$ – C. E. Nov 29 '17 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.