Reputation: 33615
Can anyone tell me whats wrong with this:
put(('%s%s.tar.gz' % config.SERVER_PROJECT_PATH, config.RELEASE))
TypeError: not enough arguments for format string
I just want insert two variables in to the string, is my syntax correct?
Upvotes: 1
Views: 2801
Reputation: 5308
The syntax is incorrect. The string formatting arguments must be a tuple. You are creating a tuple with the formatted string and the second formatting argument. Use this instead:
put("%s%s.tar.gz" % (config.SERVER_PROJECT_PATH, config.RELEASE))
Upvotes: 2
Reputation: 1121614
You need to put the two values in a tuple:
put('%s%s.tar.gz' % (config.SERVER_PROJECT_PATH, config.RELEASE))
otherwise Python sees this as two separate expressions to form a tuple, '%s%s.tar.gz' % config.SERVER_PROJECT_PATH
and config.RELEASE
.
Upvotes: 5