I'd like to know how can I call Mathematica functions from Python.
I appreciate a example, for example, using the Mathematica function Prime.
I had search about MathLink but how to use it in Python is a little obscure to me.
I tried to use a Mathematica-Python library called pyml but I hadn't no sucess, maybe because this lib looks very old (in tutorial says Mathematica 2 or 3).
Tried compile a source in Wolfram/Mathematica/8.0/SystemFiles/Links/Python but ended with several errors when using python 2.6 (documentation says should work to python 2.3 only).
Pythonika is interesting, but, looks like is just to use in Mathematica notebooks and I would like write .py files who calls Mathematica functions.
So, someone knows a good way to write python programs who uses Mathematica functions and can give me an example?
I had found a solution.
Steps:
1-Create a script named runMath with the content:
2-I gave execution privilege to the file.
3-Moved the file to the execution path
4-Created a new script called run with the content:
5-Moved to the execution path
6-Finally, tested it:
You can use with or without
'. The'are needed for commands with spaces.Happy!