SOLVED
I have this string:
' ServerAlias {hostNameshort}.* www.{hostNameshort}.*'.format(hostNameshort=hostNameshort)
But it keeps giving me a syntax error. The line is supposed to be this bash equivalent:
echo " ServerAlias ${hostOnly}.* www.${hostOnly}.*" >> $prjFile
Mind you the first string is a part of a myFile.write function but that isn't the issue, I can't even get the string to make enough sense for it to let me run the program.
Traceback:
File "tomahawk_alpha.py", line 89
' ServerAlias {hostNameshort}.* www.{hostNameshort}.*'.format(hostNameshort=hostNameshort)
^
But no matter how I change that ' symbol it doesn't seem to work. What am I doing wrong?
In response to @mgilson:
myFile = open(prjFile, 'w+')
myFile.write("<VirtualHost 192.168.75.100:80>"
" ServerName www.{hostName}".format(hostName=hostName)
' ServerAlias {hostNameshort}.* www.{hostNameshort}.*'.format(hostNameshort=hostNameshort)
" DocumentRoot ", prjDir, "/html"
' CustomLog "\"|/usr/sbin/cronolog /var/log/httpd/class/',prjCode,'/\{hostName}.log.%Y%m%d\" urchin"'.format(hostName=hostName)
"</VirtualHost>")
myFile.close()
I had each line in it's own myFile.write line, but it only produced the first line and then quit. So I assumed calling it once and spacing it like that would create intended result.
'are closed as well.SyntaxError: invalid syntax