I am trying to publish a draft service definition using arcpy.mapping.CreateMapSDDraft and am getting the referenced Assertion Error. I've tried the responses to users with similar questions with no luck.
Here is the code I am working with:
# Import system modules
import arcpy, os, sys
from arcpy import env
# Set local variables
wrkspc = r"\\intruder11\grc\sw\core\dev\gp\hosted_services_sp"
mapDoc = arcpy.mapping.MapDocument(wrkspc + 'NoMap.mxd')
outputFolder = r"\\intruder11\grc\sw\core\dev\gp\hosted_services_sp"
sddraft = mapDoc + service + '.sddraft'
summary = 'Test of publishing automation'
tags = 'CNR Southwest, dev, test, acc'
# Sign-in to Portal for ArcGIS
logger.info('Signing into built-in ACC account')
arcpy.SignInToPortal_server("--","--", "https://--")
### create service definition draft
analysis = arcpy.mapping.CreateMapSDDraft(mapDoc, sddraft, service, 'MY_HOSTED_SERVICES',con, True, None, summary, tags)
### Sign out from ArcGIS Online
arcpy.SignOutFromPortal_server()
os.path.join(wrkspc, 'NoMap.mxd')