[Tutor] invoking system commands from python

Fulvio Copex copellifulvio at yahoo.it
Wed Sep 29 12:04:51 CEST 2004

i'm new to this list and to python too.
I'm using active state python 2.3 on win32,
my problem is the following: 
I want learn how to execute system command passing parameters.
for example to copy a file I've tried to write this script:
import os
parameters="file1 file1_backup"
myCmd = os.popen(cmd,'w')
exitCode = myCmd.close()
if exitCode:
    print '%s failed, this probably says why:\n%s' % (cmd, myCmd)
the problem is that it doesn't work (the file file1_backup is not created)
and it writes the following line:
copy failed, this probably says why:
<closed file 'copy', mode 'w' at 0x01177660>
have tou any idea?

Scopri Mister Yahoo! -  il fantatorneo sul calcio di Yahoo! Sport'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040929/ff4caa42/attachment.html

More information about the Tutor mailing list