Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Python gp.ListFeatureClasses return only one file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
yoann06  
View profile  
 More options Oct 13 2011, 7:59 am
Newsgroups: comp.soft-sys.gis.esri
From: yoann06 <ydroco...@gmail.com>
Date: Thu, 13 Oct 2011 04:59:38 -0700 (PDT)
Local: Thurs, Oct 13 2011 7:59 am
Subject: Python gp.ListFeatureClasses return only one file
Hi All,
I m using the gp.ListFeatureClasses to make a list of file in my
directory (containing several hundreds of file)
however when I print the variable in which the List is supposed to be
stored, the print just return one file name....
does any one have an idea????

# Import system modules
import sys, string, os, arcgisscripting, glob, arcpy

# Create the Geoprocessor object
gp = arcgisscripting.create()
# define the workspace
gp.Workspace = r"F:\front\shp_Files\calving_front"
# list the file in the workspace

try:
    shpList = gp.ListFeatureClasses("*.shp")
    shp = shpList.Next()
    print shp

except:
    print arcpy.GetMessages() # allows to get error message when they
happen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Me  
View profile  
 More options Oct 13 2011, 11:05 pm
Newsgroups: comp.soft-sys.gis.esri
From: Me <d...@sk.me>
Date: Thu, 13 Oct 2011 23:05:01 -0400
Local: Thurs, Oct 13 2011 11:05 pm
Subject: Re: Python gp.ListFeatureClasses return only one file
Yoann,

you have to "consume" your list.
In pseudo code (sorry, I don't know Python):

'Get your list
list = getFileList()
'access the 1st (only) item
listItem = list.next()

'While there are some items left, process
while listItem
        'Print its name (or do some real processing with it)
        print listItem.name
        'Access the next item
        listItem = list.next
end while

On 13/10/2011 7:59 AM, yoann06 wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »