def execute(self, parameters, messages): ### Declaring a text string that points to an existing *.sde file on the local ### disk will cause ArcCatalog to crash when attempting to publish ### a result from running this tool as a GP Service myGeodatabase = "C:/Data/test.sde" ### The following approach seems to ### workaround this for now: myGeodatabase = "C:/Data/"+"test.sde" return
Solved! Go to Solution.
TestWorkspace= arcpy.Parameter( displayName="TestWorkspace", name="TestWorkspace", datatype="Workspace", parameterType="Required", direction="Input") ### Cannot set a default value in code - this will ### crash ArcCatalog when the tool result is published: # TestWorkspace.value = "C:/Data/test.sde"
esriJobMessageTypeError: ERROR 000732: TestWorkspace: Dataset C:\Users\Administrator\AppData\Local\ESRI\Desktop10.1\Staging\arcgis on localhost_6080 (admin)\63\v101\test.sde does not exist or is not supported #
# Esri start of added variables import os, arcpy g_ESRI_variable_1 = os.path.join(arcpy.env.packageWorkspace,u'ne2k864_DB_auth.sde') # Esri end of added variables #........ def execute(self, parameters, messages): """The source code of the tool.""" wrkspc = g_ESRI_variable_1 return
myGeodatabase = os.path.join(u"C:/Data","test.sde") featureClassPrefix = u"/test.sde." ### Sometimes this will get replaced with a path that points to the staging folder...sometimes ArcMap crashes entirely...sometimes it's left untouched. pointFeatureClass = myGeodatabse+featureClassPrefix+u"TestPoints"
>>> import os >>> start = "sde.sde" >>> end = ".fc1" >>> sdeServer = "c:/mydata/somesde.sde" >>> print os.path.join(sdeServer, start + end) c:/mydata/somesde.sde\sde.sde.fc1
>>> start2 = "/test.sde" >>> print os.path.join(sdeServer, start2 + end) /test.sde.fc1
import mimetypes mtype = mimetypes.guess_type(filename)[0].split("/")
import mimetypes mtype = os.path.split(mimetypes.guess_type(filename)[0])