35
votes
Accepted
How to programmatically extract mathematical formulas from Word with Mathematica 9?
Get all the files here.
.NET Mathematica Word Library
You will need to use a Microsoft library to open word documents. In a language such as .Net it is very easy; just open Visual Studio, reference ...
34
votes
How can I use the Python library networkx from Mathematica?
Mathematica 12.0 brings two new features that make this easier to do than it was before:
ExternalFunction
Wolfram Client for Python
Below we implement a function <...
20
votes
Accepted
How to use the library exported from FunctionCompileExportLibrary outside of Mathematic (e.g., in Visual Studio)?
This is a quick example of calling the exported compiled function from a standalone executable on Windows.
A few things to note which are currently undocumented and that can definitely be subject to ...
17
votes
Accepted
How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?
I believe you're not in the correct direction, optimizing your Mathematica code should be more practical and easier. (You've already learned the numeric capability of Mathematica under your previous ...
16
votes
ExternalEvaluate for Python fails with Import::nopythonevals
To get this out of the way:
I believe the Import::nopythonevals message will be issued by Import[..., "PythonExpression"] if ...
14
votes
Accepted
FindExternalEvaluators["Python"] gives me an uninstalled version of Python
Update: As of version 12, one should use
FindExternalEvaluators["Python", "ResetCache" -> True]
To turn my comment into an answer, ...
14
votes
How can I use Python's SciPy and NumPy functions in Mathematica to find the minimum of a function?
The first solution will use socket to connect python and Mathematica. We'll set up a server that returns the result of the function that has been defined in ...
13
votes
Accepted
Can't run Bash scripts from within Mathematica 10.1
(Reposting my comment as an answer)
The reason this is happening is that the Mathematica launcher script sets LD_LIBRARY_PATH so that libraries included in the ...
13
votes
Accepted
How to obtain the distance (in Km/Miles and in minutes) by road ?. for example using googlemaps
You can use TravelDistance and related functions to find the distance by road. Example:
...
13
votes
How to display images inside Mathematica with matplotlib
Seems to be able to embed images by converting to png.
...
12
votes
How to run a shell script from inside Mathematica
The issue here is that when Mathematica executes an external system command, at least on Linux, it does so from the current directory. You can verify this via
...
12
votes
Accepted
"ExternalLanguage" cell with ExternalSessionObject
This has to be done at the stylesheet level and here's a way to do it. First we'll make a new CellEvaluationFunction that uses the ...
12
votes
Accepted
How to open a Python interpreter input cell?
Type > at the start of a cell (or when between cells). This is documented in an example on ref/ExternalEvaluate (last Basic Example). I'm a bit suprised it's not in the details section. It probably ...
11
votes
Accepted
11
votes
How to add new python type translation to ExternalEvaluate?
A class who inherits the WLSerializable class and overrides the to_wl method can be automatically converted.
...
10
votes
Error when implementing StartProcess[] in loops (Do, While, Table)
The problem is that the stdin stream for each process is being left open and needs to be closed.
To demonstrate the issue, we create a single process:
...
10
votes
Accepted
How to get output from standard error in command line?
Under most operating systems you can use the 2>&1 handle redirection operator(1),(2):
Import["!foo 2>&1", "Text"]
...
9
votes
Error when implementing StartProcess[] in loops (Do, While, Table)
We had a bug like this on v. 10: it specifically stopped running new processes after you created 100 of them. This was fixed in version 10.0.1. I recommend testing it there, as version 10.0.1 has a ...
9
votes
Get both output and return code of external program
For those who will encounter the same problem as mine (and OP's), I added this answer.
Mathematica now(since 10.0.0) has a new built-in function called RunProcess ...
8
votes
How to close external app from Mathematica?
On Windows this works:
Run["taskkill /im chrome.exe /f"]
Run["taskkill /im WolframPlayerPro.exe /f"]
8
votes
How to close external app from Mathematica?
There are many ways to do this on a Mac. For example to open Safari:
<< "!open -a Safari"
To open Safari to a particular file or page:
...
8
votes
Why does Mathematica use a different $PATH than terminal?
I think this is an OS X issue. Note that if you launch Mathematica from a terminal, you will get the value of Environment["PATH"] which you expected.
For GUI ...
8
votes
Is it possible to call back to Mathematica when using Python through ExternalEvaluate?
I'm Riccardo Di Virgilio, one of the developers of ExternalEvaluate and wolframclientforpython.
There is a way to do what you want, even if the function is not documented or exposed, so the code I'm ...
8
votes
Accepted
Within Mathematica, how to export the output of python code to the Mathematica expression?
Even if the session was still open External code cell will be open after executing, you can't use the same variable name you'd defined in the external session, ...
7
votes
RunProcess seemingly does not work on my Windows system
Your RunProcess works properly in all examples and System settings are fine.
As @Oleksandr R. has admitted, date is a shell ...
7
votes
Accepted
RunProcess doesn't list files on Windows
It will work if you send a newline at the end of dir:
RunProcess[$SystemShell, All, "dir\n"] (* note the \n *)
What I do not ...
7
votes
Accepted
Use conda env for ExternalLanguage cell?
You can do this with SetLanguageCellSession. I've just answered a similar question here, see that answer for an explanation of how what you want can be done in version 12.1+:
7
votes
Accepted
7
votes
Using ImageJ filters directly from Mathematica through J/Link
This is not an answer to the main question on how to do it in Mathematica but merely one possible reason why this whole thing might not be achievable. In Java, your exact example looks like this
<...
7
votes
Control a Mathematica kernel from the front-end and from python
For this I'll make use of a little thing I recently wrote to answer a much deeper question: Control Front End in "mathlink" mode
The heart of this will be a little package to make a kernel ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
external-calls × 203python × 51
interoperability × 23
mathlink-or-wstp × 9
windows × 9
scripting × 8
files-and-directories × 7
linux × 7
programming × 5
warning-messages × 5
parallelization × 5
packages × 5
webservices × 5
external-language-cell × 5
export × 4
import × 4
evaluation × 4
kernel × 4
mac-os-x × 4
javascript × 4
nodejs × 4
linear-algebra × 3
dynamic × 3
matlab × 3
java × 3