|
POST
|
Aww, what are you doin' to me giving me data that isn't the same as what you're using! haha I just created a new table (using MS Access) with no ObjectID field and the script still completed successfully and copied the rows. I'm on 10.2.2. Not sure why it's not working for you... Could you try making new feature classes and tables that all have ObjectID fields, then edit the script to point to the new stuff and see if it runs.
... View more
02-10-2015
10:43 AM
|
0
|
0
|
1410
|
|
POST
|
I just tried it again and it works fine for me. All tables and feature classes in the MDB you sent do have an ObjectID field. What version of ArcGIS are you on?
... View more
02-10-2015
09:59 AM
|
0
|
2
|
1410
|
|
POST
|
Download this Python script file then right click, edit with IDLE. Change the local variable paths as needed. Then go to Run, Run Module.
... View more
02-10-2015
08:24 AM
|
0
|
4
|
1410
|
|
POST
|
I did try putting in a wait time (tried 5 seconds and 12 seconds) between each call but it didn't seem to make a difference. However, I have not tried it again since doing the url open calls in the with statement. But I don't see that it would be too different. I haven't tried every combination of these things. I have tried putting another for loop using range 3 so it will try three times to complete the action. If one failed, it was never able to successfully complete on the second or third try either (whether start or stop). Again though, I haven't tried this in combination with the wait time or the new code posted above with the separated functions. What I notice is that it usually gets through at least the first three services when something fails. When one service in the list actually fails, it always fails on all remaining services in the list as well. This is the same as when I was trying three times as well. It also seems to usually be on start that it fails (rather than stop).
... View more
02-09-2015
03:39 PM
|
0
|
4
|
1679
|
|
POST
|
Forgive me, I haven't used model builder much so I may have the AddMessage() part wrong. Please feel free to fix as needed. I have only been running this code in PyScripter; not ArcMap or Model Builder. My suggestion here is to put the code into a try statement and attempt to display more helpful debug information. Primarily, I'd like to know which operation it failed on (since you don't sound too sure about the line 22 bit). import arcpy
import os
# Local variables modified to work in the model as a script
#fielddb = arcpy.GetParameterAsText(3) #in memory
panels = arcpy.GetParameterAsText (0)
supports = arcpy.GetParameterAsText (1)
template = arcpy.GetParameterAsText (2)
try:
# Get all SupportIDs for where clause IN() statement
supportid = tuple(i[0] for i in arcpy.da.SearchCursor(supports, "SupportID"))
# Optional truncate
# arcpy.TruncateTable_management(template)
# Retreive only panel records that have a support and write to output table
fields = [f.name for f in arcpy.ListFields(template)]
where_clause = "SupportID IN {}".format(supportid)
#arcpy.AddMessage(where_clause)
with arcpy.da.SearchCursor(panels, fields, where_clause) as s_cursor: #too few paramenters. Expected 1
with arcpy.da.InsertCursor(template, fields) as i_cursor:
for row in s_cursor:
i_cursor.insertRow(row)
except Exception as err:
if arcpy.GetMessages(2):
arcpy.AddMessage(arcpy.GetMessages())
else:
arcpy.AddMessage(err)
... View more
02-09-2015
12:48 PM
|
0
|
6
|
1410
|
|
POST
|
Thanks, Joshua. A little off topic: I am using Python with ArcGIS Server 10.2.2 to get tokens and stop/start services. To request a token, I use urlllib2 to open the request url and read the json response. To stop/start services, I use urllib to open the request url and read the JSON response. In both cases I thought it was necessary to do it in a with statement using contextlib to close it when finished. Here is my thread. Sorry for the hijack!
... View more
02-09-2015
12:31 PM
|
0
|
1
|
1713
|
|
POST
|
Can you post your modified code since you're not using that template table to get the fields?
... View more
02-09-2015
11:31 AM
|
0
|
8
|
1410
|
|
POST
|
Maybe try being explicit and set all of the z-indexes to what you think it should be to see if it makes a difference.
... View more
02-09-2015
10:48 AM
|
0
|
0
|
728
|
|
POST
|
Is it necessary to close the url when getting JSON? python - closing files properly opened with urllib2.urlopen() - Stack Overflow
... View more
02-09-2015
10:43 AM
|
0
|
3
|
1713
|
|
POST
|
I'm not too experienced with Model Builder and I didn't know about this. Thanks!
... View more
02-09-2015
10:28 AM
|
0
|
3
|
4401
|
|
POST
|
I apologize Daniel Erklauer, I did not read your first post well and was going off what forest knutsen posted. I have not tried testing any of this yet, but you may have to use a conversion (like feature class to feature class) instead of copy features. Or better yet, maybe you could pass your whole list of shapefiles into feature class to getodatabase for a batch load.
... View more
02-09-2015
09:21 AM
|
0
|
0
|
417
|
|
POST
|
Could you use a z-index (in CSS or javascript) to order them so the infoWindow has a higher z-index value than the foldable widget? Sorry I'm not savvy enough to whip up some code, but it might be worth investigating.
... View more
02-09-2015
09:05 AM
|
1
|
3
|
728
|
|
POST
|
We decided to enable the TCPKEEPALIVE option using the default KeepAlive ettings in Linux. We've continued using the same Python script with arcpy.DisconnectUser() and closely monitoring the sessions and processes in V$SESSION and V$PROCESS. It seems that TCPKEEPALIVE is reliably cleaning up the old processes (and sessions) after arcpy.DisconnectUser(). This will be our solution until our next ArcSDE upgrade.
... View more
02-09-2015
08:58 AM
|
1
|
0
|
1439
|
|
POST
|
I really only used the template table for the field names. You could easily just put the field names in a list variable instead of calling list fields on the template table.
... View more
02-09-2015
08:48 AM
|
0
|
10
|
2609
|
|
POST
|
No, you're correct, arcpy.da.Walk() would probably be the best thing to use. I am so used to using it just in a geodatabase that I forgot that it listed folders too.
... View more
02-09-2015
08:20 AM
|
0
|
2
|
2199
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 1 | 07-31-2025 11:59 AM | |
| 1 | 07-31-2025 09:12 AM | |
| 2 | 06-18-2025 03:00 PM | |
| 1 | 06-18-2025 02:50 PM |