Hi all, I'm practicing python by rewriting some bash scripts, and I've found a few things that I can't directly translate, like certain calls to command-line tools. I've figured out how to start them with the subprocess module, but I'm wondering if I'm going to get myself in hot water memory- or performance-wise since these scripts are scheduled to run on thousands of files fairly often. Do I need to explicitly close the subprocesses, or clean them up, or something (I have some programming experience, but not a lot of experience with taking into account these kinds of issues - ie, no C ... )?
An example is a call to the command-line image manipulation program, ImageMagick: s = subprocess.Popen(['identify', '-format', ''%w %h\n'', 'testimg.jpg'], stdout=subprocess.PIPE) output = s.communicate()[0] print output # output should be the dimensions of testimg.jpg in pixels, ie, 100 50 What I'm thinking is that if, when typed into the terminal, the command appears to give me some output and then exit like the one above (or bash commands like "ls -l"), then I'm ok ... but like I said, I just don't know much about this kind of issue. Can anyone tell me if my intuition's way off on this? Thanks! -Cory
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor