My original 2.7 code is here:

```
            myFile = open(prjFile, 'w+')
            myFile.write("""<VirtualHost 192.168.75.100:80>
    ServerName www.{hostName}
    ServerAlias {hostNameshort}.* www.{hostNameshort}.*
    DocumentRoot {prjDir}/html
    CustomLog \\|/usr/sbin/cronolog /var/log/httpd/class/{prjCode}/\{hostName}.log.%Y%m%d\" urchin"
</VirtualHost>""".format(hostName=hostName, hostNameshort=hostNameshort, prjDir=prjDir, prjCode=prjCode))
            myFile.close()

```

And I am trying to make it 2.4 compatible by doing this:

```
myFile = open(prjFile, 'w+')
myFile.write("""<VirtualHost 192.168.75.100:80>
    ServerName www.%(hostName)s
    ServerAlias %(hostNameshort).* www.%(hostNameshort)s.*
    DocumentRoot %(prjDir)s/html
    CustomLog \\|/usr/sbin/cronolog /var/log/httpd/class/prjCode}/\%(hostName)s.log.%Y%m%d\" urchin"
</VirtualHost>""" % ('hostName', 'hostNameshort', 'prjDir', 'prjCode'))
myFile.close()

```

But my error is 

```
Traceback (most recent call last):
  File "testfunction.py", line 20, in <module>
    </VirtualHost>""" % ('hostName', 'hostNameshort', 'prjDir', 'prjCode'))
TypeError: format requires a mapping

```

I have searched for answers here and nothing I am trying seems to work. What am I doing wrong here?