Skip to main content
added 73 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    # arcpy.env.workspace = dataset
    arcpy.env.workspace = r"C:\temp\test.gdb\{0}".format(dataset)
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape them using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape them using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    # arcpy.env.workspace = dataset
    arcpy.env.workspace = r"C:\temp\test.gdb\{0}".format(dataset)
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape them using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string
added 1 character in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape thethem using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape the using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape them using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string
added 90 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape the using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work:

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape the using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string

I think you should research/ask about writing to a CSV file separately at StackOverflow because the technique you are using to do that is pure Python rather than ArcPy.

For the remainder I think this should work (use a modification of your file geodatabase location where I have used C:\temp\test.gdb):

import arcpy

arcpy.env.workspace = r"C:\temp\test.gdb"

datasetList = arcpy.ListDatasets('*','Feature')

for dataset in datasetList:
    arcpy.env.workspace = dataset
    fcList = arcpy.ListFeatureClasses()
    for fc in fcList:
        print arcpy.env.workspace,fc

The two main issues were:

  1. using back slashes in your pathname - you need to convert them to double backslashes, change them to forward slashes or simply escape the using the letter r like I have above
  2. the single quote in your pathname will leave Python looking for the other one to close that string
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345
Loading