# Tag Info

## Hot answers tagged external-calls

13

(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 layout will be found and used, and that setting is inherited by any external process started from the kernel. But, sometimes it may happen that the external executable is linked against a conflicting ...

7

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 applications that are started through Finder/LaunchServices, the environment (and $PATH in particular) is different and determined by the OS (this is a related recent question that had to do with ... 5 Your RunProcess works properly in all examples and System settings are fine. As @Oleksandr R. has admitted, date is a shell builtin on Windows. So there are commands date /t and time /t in cmd Windows shell that can be used instead. In Mathematica for Windows:$SystemShell == "cmd" (* True *) So something like: RunProcess[{"cmd", "/c", "date ...

3

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 Directory[] Run["! echo $PWD > file.txt"]; FilePrint["file.txt"] which is my default working directory. I actually have a line in my /home/jason/.Mathematica/Kernel/init.m file that says ... 2 It is certainly an OS X issue. Assuming the default shell is configured, when Terminal starts up it runs the script file ~/.bash_profile, which usually modifies the PATH environment variable. You can do the same thing in Mathematica with SetEnvironment["PATH" -> Import["!source ~/.bash_profile; echo$PATH", "Text"]] After which Environment["PATH"] ...

2

Pretty easy just try the below code Run["racket -t foo.rkt -l racket -e '(hello ....)'"] I don't have mathematica on this system to check it for you right now though. the trick is to run racket through kernel try this code and let us know what happened it may need bit of tweaking. remember if you can't capture the output you have to send it to a file and ...

2

Let's override the Run so it stops acting up. Needs["NETLink"]; InstallNET[]; Unprotect[Run]; Run[x___] := Module[{t, p}, LoadNETType["System.IO.Directory"]; DirectorySetCurrentDirectory[Directory[]]; t = NETNew["System.Diagnostics.Process"]; t@StartInfo@FileName = "C:\\Windows\\System32\\cmd.exe"; t@StartInfo@Arguments = "/c " <> ...

1

I failed to use RunProcess and friends even after I set SSH with empty passphrase for my test repository. I don't know how to proceed this way but maybe someone is interested in the work around I'm using. I'm using Batch file (I'm working on Windows, sorry). With a little help of MMA templates system, which is not necessary but I find it convenient. So ...

1

Run["start notepad C:\\Users\\Dimitris\\Desktop\\C32EXE\\composites.dat"]; Finish editing. Then: Run["C:\\Users\\Dimitris\\Desktop\\C32EXE\\composites.exe"];

1

It may be possible - as noted by @MarcoB its quite a convoluted way of doing things. I would just download R and RStudio and work from there. However if you are set on using IBrokers via the R api via RLink try this (disclaimer it crashed for me on 10.1) : Needs["RLink`"]; InstallR[]; REvaluate["install.packages(\"IBrokers\")"]; ...

1

It has been over a year since I asked this question and I have since gotten the demo code to compile and have built and deployed several WSTP projects of my own. I suspect that the key problem above is that I was trying to compile a console application rather than a Win32 application. I also notice that in the Solution Explorer above I've included several ...

1

The following seems to work on Win7 for opening explorer.exe in a specified directory using a command line parameter: Module[{cmd = "C:\\Windows\\explorer.exe /e, \"" <> \$UserAddOnsDirectory <>"\""}, Print@cmd; Run[cmd]] Also, Rui Liu (Wolfram Technical Support) provides this detailed answer regarding the vagaries of the Run command for ...

Only top voted, non community-wiki answers of a minimum length are eligible