1

I have 1 folder with shapefiles and a geodatebase. I'm trying to export the shapefiles and geodatebase feature datasets but I need to reference 2 Workspace Environments in order for the script to read both destinations.

Error Message: Runtime error Traceback (most recent call last): File "", line 68, in File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\conversion.py", line 1811, in FeatureClassToGeodatabase raise e ExecuteError: ERROR 000732: Input Features: Dataset 'ODORANT TEST POINTS.shp';COMPONENTS.shp;FARM_TAPS.shp;LINE_MARKERS.shp;MAIN_LINES.shp;METERS.shp;SERVICE_LINES.shp;STATIONS.shp does not exist or is not supported

  # Read (2) Workspace environments 
  67. for ws in workspaces:
  68.     arcpy.env.workspace = ws

Code:

# Import modules
import arcpy

arcpy.env.overwriteOutput = True

# Set environment settings
workspaces = [
    'M:/EIS_DRAFTS/EIS/Company SHP Files'
    'M:/EIS_DRAFTS/EIS/Company SHP Files/Company UPDM.gdb'
]

# Set local variables
in_dataset_P_Integrity = ['P_Anomaly', 'P_AnomalyGroup',
'P_ConsequenceSegment',
'P_ControlPoint',
'P_CouldAffectSegment',
'P_DASurveyReadings',
'P_DocumentPoint',
'P_DOTClass',
'P_Elevation',
'P_GasOdorReport',
'P_HighConsequenceArea',
'P_ILIGroundRefMarkers',
'P_ILIInspectionRange',
'P_ILISurveyGroup',
'P_ILISurveyReadings',
'P_InlineInspection',
'P_InspectionNote',
'P_InspectionRange',
'P_LeakSurvey_AreaSurvey',
'P_LeakSurvey_Atmosphere',
'P_LeakSurvey_BareSteel',
'P_LeakSurvey_Business',
'P_LeakSurvey_CastIron',
'P_MAOPCalcRange',
'P_OperatingPressureRange',
'P_PipeCrossing',
'P_PipeExposure',
'P_ServiceInterruptionEvent',
'P_StationSeries',
'P_TestPressureRange']

in_dataset_P_PipeSystem = ['P_CompressorStation', 'P_ControllableFitting',
'P_CPAnode',
'P_CPBondJunction',
'P_CPBondWire',
'P_CPRectifier',
'P_CPRectifierCable',
'P_CPTestPoint',
'P_DehydrationEquip',
'P_Drip',
'P_ExcessFlowValve',
'P_GasLamp',
'P_GatheringFieldPipe',
'P_LineHeater',
'P_MeterSetting',
'P_NonControllableFitting',
'P_Odorizer',
'P_PigStructure',
'P_Pipes',
'P_PipeSystem_Net_Junctions',
'P_PressureMonitoringDevice',
'P_PumpStation',
'P_RegulatorStation',
'P_ReliefValve',
'P_RiverCrossing',
'P_RuralTap',
'P_Scrubber',
'P_Service',
'P_Strainer',
'P_Tank',
'P_TownBorderStation',
'P_Valve',
'P_Well']

in_dataset_P_EverythingElse = ['ODORANT TEST POINTS.shp', 
'COMPONENTS.shp',
'FARM_TAPS.shp',
'LINE_MARKERS.shp',
'MAIN_LINES.shp',
'METERS.shp',
'SERVICE_LINES.shp',
'STATIONS.shp']

out_dataset_P_Integrity = 'C:/EnterpriseFolder/Company.gdb/P_Integrity'
out_dataset_P_PipeSystem = 'C:/EnterpriseFolder/Company.gdb/P_PipeSystem'
out_dataset_P_EverythingElse = 'C:/EnterpriseFolder/Company.gdb'

try:
    for ws in workspaces:
        arcpy.env.workspace = ws
        # Use ListFeatureClasses to generate a list of inputs
        for infc in arcpy.ListFeatureClasses():

        arcpy.env.outputMFlag = "Disabled"
        arcpy.env.outputZFlag = "Disabled"

        #Execute FeatureClassToGeodatabase
        arcpy.FeatureClassToGeodatabase_conversion(in_dataset_P_Integrity,out_dataset_P_Integrity)
5
  • "I feel like this piece isn't searching correctly" - what is it doing or not doing exactly? Can you be more specific?
    – Midavalo
    Commented Jun 8, 2017 at 15:08
  • @Midavalo The script isn't searching the 2 workspace environments for the defined shapefiles and feature datasets listed in my #Set local variables. Error Message Reads: does not exist or is not supported
    – Jordan
    Commented Jun 8, 2017 at 15:20
  • Please edit your question to include your entire error message text including any line numbers
    – Midavalo
    Commented Jun 8, 2017 at 15:27
  • Remove the spaces from your folder/workspace names and re-test (you'll need to actually rename them, not just change them in python). You could test on a copy without spaces if you can't rename those folders.
    – Midavalo
    Commented Jun 8, 2017 at 16:25
  • @Midavalo The spaces have been removed on the folders but it's still unable to read the 2 workspace environment directory paths.
    – Jordan
    Commented Jun 8, 2017 at 17:33

1 Answer 1

2

Your error appears to be in the arcpy.FeatureClassToGeodatabase_conversion(), not in the arcpy.env.workspace.

Your script is attempting to pass a list of values (feature classes or layers?) to the Feature Class to Feature Class tool, however this tool requires a single feature class or layer input.

You either need to loop through the values in this list, something like the following:

inputlist = ['roads', 'boundaries', 'trees']
outputfolder = r"c:\temp\geodatabase.gdb"

for fc in inputlist:
    arcpy.FeatureClassToGeodatabase_conversion(fc, outputfolder, fc)

Or use Feature Class to Geodatabase to convert multiple feature classes to a Geodatabase

inputlist = ['roads', 'boundaries', 'trees']
outputfolder = r"c:\temp\geodatabase.gdb"

# Execute TableToGeodatabase
arcpy.FeatureClassToGeodatabase_conversion(inputlist, outputfolder)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.