Results not doesn't output . I get an error please help .
Can someone please tell me what's wrong with this ? I'm just starting out in programming. I can run the script but the results don't show. I get an error please help.
filein = open( 'IOS.j2' )
src = string.Template( filein.read() )
hostname = input("Enter the hostname: ")
subnet = input("Enter the third octet: ")
secret_type = input("Enter the secret_type: ")
d={ 'hostname':hostname, 'secret_type':secret_type }
result = src.substitute(d)
#print result
fileout = open( hostname + '.cfg', 'w' )
fileout.write(result)
Thanks for any help .
LogCat
Traceback (most recent call last): File "rtrtemplate.py", line 33, in result = src.substitute(d) File "C:\Users\AppData\Local\Programs\Python\Python37\lib\string.py", line 132, in substitute return self.pattern.sub(convert, self.template) File "C:\Users\AppData\Local\Programs\Python\Python37\lib\string.py", line 129, in convert self._invalid(mo) File "C:\Users\AppData\Local\Programs\Python\Python37\lib\string.py", line 105, in _invalid (lineno, colno))