Solved! Go to Solution.
import arcpy
try:
msd= r"C:\GeoSpatialTraining\ArcGIS 10\GIS Programming 101\Exercises\crime.msd"
arcpy.mapping.PublishMSDToServer (msd, "http://localhost/arcgis/services", "localhost", "MyMapService", "", ["WMS", "KML"])
except IOError as e:
print "I/O error({0}): {1} {2}".format(e.errno, e.strerror,e.message)
Make sure you have a bunch of cfg files in a folder similar to: c$\Program Files (x86)\ArcGIS\Server10.0\server\user\cfg. These are the config files for the services and if they don't exist then the configs only exist in ram.