[Tutor] python interpreter vs bat file

Alan Gauld alan.gauld at btinternet.com
Mon Jul 20 00:22:47 CEST 2009


"Dinesh B Vadhia" <dineshbvadhia at hotmail.com> wrote 

> Bob Gailer suggested running the Python programs individually 
> in CMD one after the other.  This is sensible but my test programs 
> run for days and the full suite of programs take longer.  

OK, But it can't take longer than in IDLE? Or even in the bat file.
So you can start the program running and then iconify it.

The reason this is important is that IDLE catches some errors 
that the normal python interpreter does not So IDLE may be 
masking a real problem in your code. However...

> The programs are memory intensive (the 64-bit machine 
> has 8gb ram).  Hence, it is not easy to test this scenario 
> right now.

Have you chedked in Task Manager how much RAM the python 
programs use up - they should be visible in the process tab.

If it is a lot then maybe we can rewrite the code to use less 
memory (Or maybe leak less memory).

> It seems to me as if Windows is not freeing up memory 
> between Python invocations in the batch file but can't be 
> sure.  

Windows should free up the memory, but it might depend on 
how you run the programs. In your earlier post you said the 
bat file contained lines like

python foo.py
python bar.py

You could try usng the start command instead, as in:

start foo.py

You might want to explore the /I, /B and /WAIT options

start gives you a lot more control over the execution environment.

Notice you don;t need the 'python' because start uses the file 
association.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list