Running time in CMD and IDLE - Program running time is about the same in both CMD and IDLE - The programs take a long time to run NOT because of runaway processes that are using up memory - The programs are being optimized with each successive generation to reduce resources and time but the limitations boil down to Python for-loops (within functions) and sorts (probably the subject of another note to Tutor).
IDLE masking program errors - Could be but ... - The programs work under IDLE and return the correct results - At this point I decided to run the programs from a batch file Batch file method - Except for one program, all other programs work using the batch file method. - The program with the error is run under IDLE and combined at the end with the output of the batch file programs and correct results are returned. Program memory use - The program with the memory error uses a lot of memory but the data structures should fit into available memory as it does when run with IDLE Use of DOS Start command - I'll try out the /I, /B and /WAIT commands in the next run and will let you know what happens. Thanks. Dinesh -------------------------------------------------------------------------------- Message: 1 Date: Sun, 19 Jul 2009 23:22:47 +0100 From: "Alan Gauld" <alan.ga...@btinternet.com> To: tutor@python.org Subject: Re: [Tutor] python interpreter vs bat file Message-ID: <h406bp$jd...@ger.gmane.org> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original "Dinesh B Vadhia" <dineshbvad...@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/ ------------------------------ Message: 2 Date: Sun, 19 Jul 2009 23:36:03 +0100 From: "Alan Gauld" <alan.ga...@btinternet.com> To: tutor@python.org Subject: Re: [Tutor] hitting a wall (not a collision detection question :P) Message-ID: <h4074l$l0...@ger.gmane.org> Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original "Michael" <punkbohem...@yahoo.com> wrote > ...everything up to functions vs. methods and the basics of classes > and OOP. This is where I'm hitting a wall. It's at this point the all the > books go off in different directions OK, First thing is don;t worry about it, you are far from alone. Many, Many programmers (even long term pros) find the transition from functions to objects really hard to adjust to. Not surprising, since it doers require a new way of thinking about program structure. Eventually the OOP way will become second nature, in fact you might even find it hard to think about ordinary functions after a while! But it can take a while. > and I'm not sure a) what I'm learning, b) why I'm learning it, > and c) how this is going to help me get to my goals. It might be good to throw us some specific questions and we can try to answer them. General questions tend to produce vague answers! You can try my tutorial on OOP to see if that helps. Follow it up with the case study to see OOP in action. > I'm not really even understanding much of what these books > are talking about at this point anyway. Again, anything you are unsure about tell us and we can try to explain. That isd what this klist is really good at because there are many different perspectives who have all gone through the same learning curve. Someone likely has the same way if thinking about it as you do! > It's like a few chapters after "Classes and OOP" were torn out of all of > them. :-) > So, I'm just wondering what I should be doing at this point. Start writing code. Don't worry about OOP too much but look out for when you use objects in normal python code - like strings and files for example - and see how the library writers did things. Look for things in your code that sound like they might be objects, try writing a class to bring together the data and the functions that work on that data. The more you use objects and classes the more familiar they become and what works and doesn't work becomes obvious. Until you use them it all remains somewhat academic. > this is about as specific as I can be. Go back to those tutorials and find the bits you aren't sure about and just ask - what does this mean? How should I use this? And why? Is this a sensible way to program this? etc etc... We will try to help. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor