|
POST
|
Not sure about field calculator, but cursors will work well for this. photo_field = "your_path_field" curs = arcpy.SearchCursor(fc,"","",photo_field) for row in curs: photo_path = row.getValue(photo_field) if os.path.exists(photo_path): print "%s exists" % os.path.basename(photo_path) else: print "%s not found" % os.path.basename(photo_path) Alternatively you can use an update cursor and fill a field with Exists Y/N during the check.
... View more
07-31-2012
11:23 AM
|
0
|
0
|
1950
|
|
POST
|
Are you talking about creating dynamic variables for each item in your list? I don't think you really want to do that. You would want to use a dictionary to be able to look up when writing your output. Something like this. members_dict = {}
for index,name in enumerate(lMembers,1):
members_dict[index] = name I'm still not clear on what you are doing with the index number though. Do you have a specific example of what your want your output string to be?
... View more
07-31-2012
11:15 AM
|
0
|
0
|
2569
|
|
POST
|
Yes the names populate correctly. The reason the list 'could' be empty is if there are no people in that Team yet. The team name woudl exist in the teams table by has no members at this time, so i need to account for that. I'm very new to Python (like a week) and I'm unaware of dictionaries, which is why I didn't use them 🙂 Thanks for the other tips. [ATTACH=CONFIG]16519[/ATTACH] I've attached the run screen as a screenshot Yes your list is empty so you will never enter this loop.
for item in lMembers:
wMembers = item
arcpy.AddMessage(item)
Add this line before the loop to avoid undefined problems. item = None
... View more
07-31-2012
10:34 AM
|
0
|
0
|
2569
|
|
POST
|
This is a case where dictionaries would have been superior. You have nested cursors which is frowned on in some circles, but as long as you know the cost isn't too high it shouldn't break anything. One note, when you are trying to reset a variable, I would avoid setting it to values like z = 0 or z = " ". Use z = None instead. These are mostly minor things and I don't see why your list would be empty. Is this printing out all the expected names? for z in rowMembers:
mName = z.getValue("Name")
lMembers.append(mName)
arcpy.AddMessage(mName)
... View more
07-31-2012
10:15 AM
|
0
|
0
|
2259
|
|
POST
|
The Windows Authentication is required to execute the script. Because of securities you cannot anonymously execute a potentially damaging script/program without authentication. This is supplied automatically when you are logged in as you are already authenticated, but not when the user is logged out and it is executing through a scheduled task.
... View more
07-31-2012
09:50 AM
|
0
|
0
|
4459
|
|
POST
|
You get that error if your list is empty. Try posting your entire code that may help track down the problem.
... View more
07-31-2012
09:46 AM
|
0
|
0
|
2259
|
|
POST
|
Here's a better explanation The list lMembers contains values such as [jon, pete, paul, steve, etc] when I iterate that list later I want to pull the values from this list and write them to an output, building an FDF file. The code is attempting to do the following
loop for as many times as there are items in the list
for each list item, write that value to a output variable that can then be written out
I'm not sure how to create an FDF file. All you need to do to get each item in the list is this.
for item in lMembers:
#Write item to output
... View more
07-31-2012
09:17 AM
|
0
|
0
|
2259
|
|
POST
|
What are you trying to accomplish? You are referencing your list items as an index which isn't how it works. Your i variable holds your list value. Try this to see if it is what you want.
for i in lMembers:
arcpy.AddMessage(i) Edit: If for whatever reason you need the index value as well, use the enumerate built-in. for index,item in enumerate(lMembers):
arcpy.AddMessage(index,item)
... View more
07-31-2012
08:48 AM
|
0
|
0
|
2259
|
|
POST
|
It depends on your environment, but I would think you would need to run the actual script through task scheduler as your domain/server admin account with password, then define the credentials to the database in the script/connection file.
... View more
07-31-2012
08:41 AM
|
0
|
0
|
4459
|
|
POST
|
Try setting your tolerance down to 1 Meter, that worked for me, not sure why. I was having problems with the 5 Meter tolerance as well, I'd think about filing a bug report with Esri. Edit: Also you need to export to a geodatabase. Shapefiles weren't working for this either.
... View more
07-31-2012
07:18 AM
|
0
|
0
|
2616
|
|
POST
|
You don't have a projection. That has to be set to work with tolerances.
... View more
07-31-2012
06:55 AM
|
0
|
0
|
2616
|
|
POST
|
Try doing a repair geometry on your source. Do they have Z values that might put them outside the tolerance? I'm not sure how Z values interact with XY tolerance actually.
... View more
07-31-2012
06:23 AM
|
0
|
0
|
2616
|
|
POST
|
Make sure the account you are running it with has domain privileges to connect to another server. And that the target database allows this user to connect.
... View more
07-31-2012
05:34 AM
|
0
|
0
|
4458
|
|
POST
|
Did you set the multi_part parameter to SINGLE_PART?
... View more
07-31-2012
05:33 AM
|
0
|
0
|
2616
|
|
POST
|
There is no function available to arcpy to modify this property of a layer in an mxd that I know of in 10.x. And in regards to the above solution, you don't need to select all the layers, just ctrl+mouseclick on the expand/collapse toggle button will do it.
... View more
07-25-2012
07:03 AM
|
0
|
0
|
1454
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-17-2011 10:36 AM | |
| 1 | 08-16-2012 10:48 AM | |
| 1 | 10-31-2012 08:39 AM | |
| 1 | 07-16-2012 01:52 PM | |
| 1 | 03-15-2012 10:57 AM |
| Online Status |
Offline
|
| Date Last Visited |
08-22-2024
11:12 PM
|