os.system function

Jeremy Sanders jeremy+complangpython at jeremysanders.net
Mon Jan 11 23:31:07 CET 2010

Zabin wrote:

> Thanks for the pointers....i had a look around and found the site:
> to disable the prompt- i needed to include /y as below:
>  os.system ('xcopy /s %s %s /y ' % (dirExe, dirname_new))
> and just wondering- whats the drawback of using os.system() command

- It won't work across different platforms (unix, mac, windows)
- Spaces or special characters in the filename will mess up the command line 
and can lead to huge security flaws in your program.
- It's inefficient as you have to start a new program to do the work (slow 
on windows)
- Error handling from the xcopy process will not be easy

Jeremy Sanders

More information about the Python-list mailing list