Reputation: 3071
I am getting the following error,it says not enough arguments,am already passing two arguments...what is wrong here?
check_call("rm -rf %s/%s/*" % SCRIPT_ROOT % W_ROOT,shell=True)
TypeError: not enough arguments for format string
Upvotes: 0
Views: 86
Reputation: 174624
check_call('rm -rf {}/{}/*'.format(SCRIPT_ROOT,W_ROOT),shell=True)
Also, make sure you know the implications of shell=True
, especially since you seem to be doing a destructive operation.
What happenes if any one of the arguments is ../../
?
Upvotes: 2
Reputation: 251355
You can't do the formatting in two steps like that. You need to use one %
operator and pass a tuple:
"rm -rf %s/%s/*" % (SCRIPT_ROOT, W_ROOT)
Upvotes: 2