Generate config file from template using Python search and replace.

Peter Otten __peter__ at web.de
Mon Nov 30 04:14:16 EST 2015


Mr Zaug wrote:

> On Sunday, November 29, 2015 at 5:50:51 PM UTC-5, Peter Otten wrote:
>> Mr Zaug wrote:
>> 
>> > When I run this script on OS X El Capitan, I see,
>> >   
>> >   # permission sensitive cache
>> >   $include "_dispatcher_shared_auth-checker:
>> > 
>> > Was I supposed to incorporate it into the script I posted?
>> 
>> Are you referring to my post? I'm sorry, I can't make sense of your
>> question.
> 
> Yes. The snippet you posted went way over my head. When I ran it, it
> printed
> 
> # permission sensitive cache
>   $include "_dispatcher_shared_auth-checker:

It's hard to tell from that problem description what might have gone wrong. 
However:

In your template file you have to enclose all words you want to replace in 
braces ("you have foo options" becomes "you have {foo} options"), to replace 
all literal { with {{ and all literal } with }}.

Did you do that?




More information about the Python-list mailing list