AnsweredAssumed Answered

Scratch GDB being treated as folder instead of FGDB in script

Question asked by MollyKFoley on May 31, 2018
Latest reply on May 31, 2018 by MollyKFoley

I am writing output data to the scratch geodatabase in a script - it was working great before but now it is no longer working and I'm trying to figure out if it's an IDE problem or something else. When I write data to the scratch geodatabase, it is treating it as a folder and appending ".shp" to the end of the output data instead of treating it as a file geodatabase and writing the output data as a feature class like it's supposed to. Additionally, it will run through the first tool call and write the output, but then the second tool call results in an error because it's trying to append ".shp.shp" to the output data name which is obviously invalid... I'm leaning towards this being an IDE problem because the script works great if I add the toolbox to ArcMap and run it inside there. Has anybody else seen this fishy behavior using PyCharm? 

 

The problem script:

scratchGDB = arcpy.env.scratchGDB

#First tool call appends .shp to singlepart
#output looks like this: C:\Users\xxx\AppData\Local\Temp\scratch.gdb\singlepart.shp
svyPtFC = arcpy.MultipartToSinglepart_management(multipartFL, os.path.join(scratchGDB, 'singlepart'))

#Second tool call tries to append .shp.shp to FinalOutput
#Error says: ExecuteError: ERROR 000210: Cannot create output
#C:\Users\xxx\AppData\Local\Temp\scratch.gdb\FinalOutput.shp.shp
#ERROR 000354: The name contains invalid characters
filename = os.path.join(scratchGDB, "FinalOutput")
svyPtFC = arcpy.Eliminate_management(sliverFL, filename)

 

It truly does write the shapefile out into the geodatabase folder:

 

If I run this code to check if it's a geodatabase I get this:

scratchGDB = arcpy.env.scratchGDB

desc = arcpy.Describe(scratchGDB)
print desc.workspaceType

#Prints "FileSystem"

 

How do I get it to be seen as a file geodatabase when running in an IDE?

Outcomes