Nader Emami wrote:
L.S.,

I have a long command in Unix and I have to use os.system(cmd) statement. I do the following:

cmd = '%s/mos user wmarch, cd /fa/wm/%s/%s, mkdir %s, put %s, chmod 644 %s' % (mosbin, jaar, filetype, filetype)
status = os.system(cmd)



This is not very clear, and I have to break this long line in two segment by means of the next character '\' :
cmd = '%s/mos user wmarch, cd /fa/wm/%s/%s, mkdir %s, put %s, \
chmod 644 %s' % (mosbin, jaar, filetype, filetype)


But in this case I get a syntax error! I don't know how I can solve this problem. Could somebody tell me about this?

The error you get is NOT a syntax error:

 >>> cmd = '%s format %s \
 ... over %d lines' % ('my', 'string', 2)
 >>> cmd
'my format string over 2 lines'
 >>>

The interpreter is probably complaining because it needs six values to fill out the format and you only provided four.

In future, by the way, always include the error message in such posts!

regards
 Steve
--
Steve Holden               http://www.holdenweb.com/
Python Web Programming  http://pydish.holdenweb.com/
Holden Web LLC      +1 703 861 4237  +1 800 494 3119
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to