os.system function

Chris Rebert clp2 at rebertia.com
Mon Jan 11 16:23:12 EST 2010


On Mon, Jan 11, 2010 at 12:43 PM, Zabin <zabin.farishta at gmail.com> wrote:
> Hey everyone!
>
> I am a new python programmer. I am trying to get the general file
> functionality with options of save and save as working. These save
> functions save a folder with multiple files. Upon using the os.system
> copy function- if my destination directory has files with similar
> names- i am asked whether i want to replace the files on the command
> prompt.
>
> Is there some way of getting this question into a dialog box?
>
> Also is there someway of avoiding or programmatically setting the
> response to the command prompt?

You can probably avoid using os.system() entirely (always a good
thing) by instead using the functions in the `shutil` library:
http://docs.python.org/library/shutil.html

And for future reference, the `subprocess` module is the preferred way
to invoke external programs, rather than os.system():
http://docs.python.org/library/subprocess.html

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list