Quesion about running a exe file in Python(Not enough memory)
Dave Angel
davea at davea.name
Thu Apr 25 17:40:13 EDT 2013
On 04/25/2013 05:18 PM, yuyaxuan0 at gmail.com wrote:
> Hey guys,
>
> I have a python script that will call an external exe file. Code is kind of like this:
>
This is a perfect example where you can simplify the problem down to a
few lines that fail for you, and actually document the environment and
the results.
> #cmd = "D:\\programs\\MIRAX_SlideAC_SDK\\Bin\\MrxSlideExport.exe -s D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Slides\\L10 -e -o D:\\fit\\projects\\bayer\\KidneyLiver\\MiraxScanner\\Output\\L10 -z 5 -f png"
> #os.system(cmd)
> #msg = os.popen(cmd, mode='r', buffering=-1) # does not work
That's a useless statement. What you really should be saying is: I ran
exactly xxx, and it formatted my neighbor's D: drive. Or you should
skip that, and just concentrate on the ancient os.system() you're asking
about. BTW, any reason you're not using the multiprocess module? It
can simplify a lot of things, for example, bypassing the shell, so you
know what the child program is really getting as parameters.
> cmd = cmdForExportingSlicesToTiles + " -s " + slicePath + " -o " + pathToResultData
> print(cmd)
> os.system(cmd)
>
> So the problem is that is says it doesn't have sufficient memory.
Who says? At what point do they say it? Show us a transcript of
exactly what you do to see this message, and actually show the message.
You probably could simplify this to 5 lines:
import os
cmd = "some literal string with lots of options"
print "About to launch program"
print cmd
os.system(cmd)
Then you run it from the cmd line, and copy/paste the results into your
mnext message.
C:\Somedir\ > python myprog.py
About to launch program
some literal...
Some message that might mention running out of memory...
Naturally, you should specify your Python version, your OS version, and
any other variables you can think of.
--
DaveA
More information about the Python-list
mailing list