I'm using Mathematica to control another program (Surface Evolver) through the terminal (ie using StartProcess[];
and WriteLine[];
). The programs communicate by writing and reading text files (Export[];
and Import[];
respectively). The script I wrote is packaged in Block[];
(Module[];
yields the same results) and run iteratively in a While[]
loop (I've also used Do[]
and Table[]
, same results). Everything works great when I run small batches of iterations. I don't think I'm running out of memory (I clear the sys cache and wipe variables within the module every iteration to prevent memory leaks because I've seen some chatter about that in other threads). However, at about n=100 I'll get an error
OpenWrite::noopen: Cannot open in:100
EDIT
Okay, this should be more manageable, I've isolated the source of the error to the repeated creation of processes. It seems like the error is not MTHM per se, but an inability to open a new system process.
Dynamic[n]
Do[Module[{TestProcess},
TestProcess = StartProcess[$SystemShell];
WriteLine[TestProcess, "echo example line"];
KillProcess[TestProcess];
Pause[0.1];
Clear[TestProcess];
ClearSystemCache[];
];,{n, 1, 1000}];
END EDIT
System Info:
- Mac OS X Mavericks
- Mathematica 10
- Screen Saver is off
,{n,1,1000}];
belongs to nothing. Otherwise, nice that you could break the problem down. It is more likely that someone can help you with this. $\endgroup$General::stream: -- Message text not found -- ($Failed)
and so on. $\endgroup$