January 9th, 2005, 02:14 PM
Python System calls
I was wondering if there is a way have python let the shell execute something instead of python, like in perl or c where you can go
and it would make a directory for you, i have been researching i know perl has ways to make direcotrys that isn't platform dependant, that is nice, but there are thing i want to do that there os module can't do, besides the script i am trying to write is only going to be running on linux so it doesn't really matter.
January 9th, 2005, 03:33 PM
Use os.system, commands.getoutput (if you care about just the text output), or one of the popen* modules if you want full control of stdin, stdout, and stderr.
January 9th, 2005, 05:21 PM
Python 2.4 added a new module called subprocess to the standard library, which was designed as a replacement to the multiple popen* modules. If you have the chance I'd use this it is a big improvement:
Originally Posted by Strike
January 9th, 2005, 07:11 PM
sweet, thanks very much. I have been wanting to go to python2.4 but i can't find a module for mysql that works with 2.4, so i have been stuck with python2.3 but the os.system works great thanks