i did some string juggling to work around this. i configured the generator of the files to use some characters in place of '{' and'}' as if str.format() used them. that avoids different things with '{' or '}' from getting confused. then when i read in the file i swap characters around so '{' and'}' are present only where the format substitutions are (e.g. "{bucket}") and i call its .format() method with the settings. then i swap the characters back so the '{' and'}' are back where they are needed in the bash code being generated.
it turns out my original idea of using '[' and ']' would have similar problems because they are also used by the generated bash code. i found that '%' and '^' are not used, so those are the characters i am swapping with ... "{}" <-> "%^". so i read in "%bucket^", change it to "{bucket}" while the bash '{' and '}' get changed to '%' and '^', call .format(), then change '%' and '^' back to '{' and '}'. done. since this is being done with Python str type i could use some high up characters such as chr(65536) and chr(65537) which are extremely unlikely to be in the generated bash code.
it turns out my original idea of using '[' and ']' would have similar problems because they are also used by the generated bash code. i found that '%' and '^' are not used, so those are the characters i am swapping with ... "{}" <-> "%^". so i read in "%bucket^", change it to "{bucket}" while the bash '{' and '}' get changed to '%' and '^', call .format(), then change '%' and '^' back to '{' and '}'. done. since this is being done with Python str type i could use some high up characters such as chr(65536) and chr(65537) which are extremely unlikely to be in the generated bash code.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.