found the issue, but again have another error. The service I am uploading is a Map Image Layer., so I had to change the item_type from
"Service Definition"
to
item_type="Map Image Layer"
However, now I am getting an error:
Traceback (most recent call last):
File "<string>", line 48, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 8655, in publish
raise ValueError("A file_type must be provide, data format not recognized")
ValueError: A file_type must be provide, data format not recognized
and here is my code as line 48 is:
fs = sdItem.publish(overwrite=True)
sdItem = gis.content.search("{} AND owner:{}".format(sd_fs_name, user), item_type="Map Image Layer")[0]
print("Found SD: {}, ID: {} n Uploading and overwriting…".format(sdItem.title, sdItem.id))
sdItem.update(data=sd)
print("Overwriting existing feature service…")
fs = sdItem.publish(overwrite=True)
is there something in item.publish() where I need to specify if it is a Map Image Layer?