|
POST
|
Thanks Pavan, I won't worry about making changes. I'm still trying to get a better understanding of how the scripting in python affects the behavior of the overall script, and how this can change the overall outcome of the desired result. The other thing that I'm still trying to grasp, that I simply don't fully understand at this point, is the direction. I know what I would like for my end result to be at times, but getting there via scripting is more challenging. I'm really familiar with modelbuilder and I can create most tools from simple models. I realized that the end result that I want to get to is sometimes missing with the given esri tools. I realized that I could fill in for those missing pieces by creating script tools to fill in those gaps, or simplify long drawn out models by simplifying them to scripts. I arrived to the conclusion that I might need to practice more and get familiar with the basics. It's just that there's more to python than I originally thought, and there's other components that I was unaware of. So this is going to take time, but I would like to eventually get to the point that I can understand these things well enough that I won't get lost in the process. Any advice on this would be heavily appreciated. - Robert
... View more
09-17-2019
05:34 PM
|
0
|
0
|
2405
|
|
POST
|
Thanks Pavan. I didn't write that portion of the script, somebody else did and so I used it to test the script and it worked. I know that with the cursors you have to use .da. I didn't know that os.walk also needed the .da as well. I will be sure to remember that.
... View more
09-17-2019
09:58 AM
|
0
|
2
|
2405
|
|
POST
|
Hi, I know this is a very simple question, but I know some python to understand some of the basics and I was wondering what would be the best possible solution, or direction, for studying python. I still struggle with small scripts from time to time, with very small number of them actually working the way I intended. So I just wanted to see if anyone has any suggestions on how to go about this. The other thing is I came across other sites and other sources of python examples that I would eventually like to be at or close to the level of a novice python developer. Eventually I would like to expand on that even further, but as of now I can handle small scripts here and there and so I am starting out low and slow. Here are somethings that I came across that I would like to know more about and be able to understand and utilize. Any of the Esri breakdowns for tools and such 10. API Reference — Python 2.7.16 documentation tkinter — Python interface to Tcl/Tk — Python 3.7.4 documentation
... View more
09-17-2019
05:34 AM
|
2
|
13
|
5571
|
|
POST
|
Thanks Pavan, I checked with one of my coworkers on this and he walked me through a process that you mentioned. Here is the script that he gave me as well as my own additions(mostly his). import os
path = r"C:\Folder\FolderName"
files = []
for r, d, f in os.walk(path):
for file in f:
if '.mdb' in file:
files.append(file)
for f in files:
##print(f)
strip = os.path.basename(file).rstrip(os.path.splitext(file)[1])
print strip This solution was what I was actually trying to get to but, with my knowledge of python being so limited, I don't have a firm grasp on it. I meet with a friend every now and then to study python, but there is more to python than I can feasibly grasp. -Robert
... View more
09-17-2019
05:18 AM
|
0
|
4
|
2405
|
|
POST
|
Ok. Because for some reason I am able to parse the path using modelbuilder and it returns the correct record. The only issue I have with using the script in modelbuilder is that I receive an error message stating the table either does't exists or it simply doesn't open. I have a slightly more dumbed down version of the model that works but I my end goal is to use the script in process with the model which would make this process more seamless. Otherwise the model and script combination that is working currently, works as two separate model tools. So I am simply trying to figure out the best approach to make two processes work as one.
... View more
09-16-2019
12:52 PM
|
0
|
0
|
2405
|
|
POST
|
Hey James, So I tested your script and it works but it populates the table with 20+ records, and so I am wondering if there is a way for me to have the table records update based on the number of files added. So if I add 3 files, then the tool adds 3 records to the table with the file names. I am really close to getting where I want to be and so I am working on this little tiny detail. Thanks, Robert
... View more
09-16-2019
10:24 AM
|
0
|
1
|
4614
|
|
POST
|
Thanks James, I was trying to make sense of the parse path script and loop. I am vaguely familiar with loops but the parse path script form the esri documentation wasn't making much sense to me. The reason I was trying to utilize the Make Table View script is because when I ran the script in process within a model, I would receive an error stating the item cannot be opened or it does not exist. I think this link that I was utilizing might have been adding my confusion but I could be wrong. Parse Path—Help | ArcGIS for Desktop I am trying to get a better understanding on how python works in terms of context and flow. I have several scripts that I have created that work the way I intended, but when I start to get into developing more complicated script, I start to get a bit confused. Huge thanks for your help James -Robert.
... View more
09-16-2019
08:31 AM
|
1
|
0
|
4614
|
|
POST
|
Thanks Johannes. I did manage to get the script working, however, I get an empty output when I run the tool and so I am not sure what I am doing wrong exactly.
... View more
09-16-2019
07:21 AM
|
0
|
0
|
4614
|
|
POST
|
I never used the code formatting before so it's new to me.
... View more
09-16-2019
06:54 AM
|
0
|
0
|
4614
|
|
POST
|
Hi, i am relatively new to python but I am trying to work on a script that works in conjunction with modelbuilder and so far things were working up to a point. The issue that I am having is I am trying to loop through a list of files, get the filenames, and update a table with the names from the files. Here is the script that I have currently: import arcpy
import os
#Set Parameters
inFiles = arcpy.GetParameterAsText(0)
inTable = arcpy.GetParameterAsText(1)
inField = arcpy.GetParameterAsText(2)
outTable = arcpy.SetParameterAsText(3)
#Iterate through files in folder, insert rows based on file names, and make table view layer
with arcpy.da.InsertCursor(inTable, inField) as cursor:
#List Files
flist = arcpy.List(inFiles)
for f in flist:
#Make table view
arcpy.MakeTableView_management(inTable)
#Get filename(s)
f = os.path.basename(flist).rstrip(os.path.splitext(flist)[1])
#Insert values and rows in table
cursor.insertRow([f])
del cursor
#Add Message
arcpy.AddMessage("This row {0} was added.".format(f)) Any help on this would be greatly appreciated.
... View more
09-16-2019
05:47 AM
|
0
|
23
|
9540
|
|
POST
|
Hi, So I am working on a model where for every database, there is a feature class that gets selected, the count is taken for that feature class, and that populates a field in a table. This model runs for every row in a designated table. But what I am trying to accomplish is : for each record in table run model to get the feature class in the database, get the count for that feature class, and calculate the count in the table. When this model runs once, run the model for the next record in the table this process repeats for every table record and every database.
... View more
09-13-2019
06:31 AM
|
0
|
6
|
1907
|
|
IDEA
|
The other thing that I am hoping for is for community users to be able to directly incorporate any custom creations in AGO and/or tools in ArcCatalog without having to directly download and/or install. Kind of like having a separate page for community users.
... View more
09-10-2019
05:23 AM
|
0
|
0
|
1261
|
|
POST
|
Hi, I am having some difficulties with a script that I have written where I am trying to use the update cursor and field calculate to populate a specified field of choosing. The script is being used in conjunction with a model and for some reason I get this error message below. Traceback (most recent call last): File "U:\Models_Tools\UpdateRowWithCount.py", line 16, in <module> calc.updateRow(SelectTableField) AttributeError: 'Result' object has no attribute 'updateRow' Failed to execute (UpdateRowCount). I would greatly appreciate any help on this.
... View more
09-09-2019
07:21 AM
|
0
|
0
|
741
|
|
IDEA
|
I was thinking of direct access sharing. Kind of like a separate page in ArcGIS Online where Esri we could enable community users add their own custom tools and/or creations to AGO directly (with Esri's Q/A) and allow for others to use them. It would be easier than to have to create, wait, or dig constantly to find something similar has already been done. But I will definitely check out the code sharing and see if I can find what I am looking for. Thanks Kory
... View more
09-09-2019
06:15 AM
|
1
|
0
|
1261
|
|
IDEA
|
Hi, I noticed that if someone has created a custom tool, widget, or script, that unless they directly share it with either GitHub or some other forum or repository, others won't be able to access it. So I was wondering if it would be possible to add a section to AGO and/or ArcCatalog for community created content that is approved by Esri, such as custom widgets, script tools, or other useful tools in general. Otherwise it is difficult to have to to keep on researching, creating internal tools or widgets, and other things that quite frankly would be nice to simply be able to use if somebody else doesn't mind sharing it. It is understandable if somethings out their pose a risk, but if the item is vetted for security reasons, then it shouldn't necessarily pose a risk. So I just thought this would be a good idea.
... View more
09-08-2019
05:06 PM
|
0
|
3
|
1380
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 1 | 02-10-2026 06:09 AM | |
| 1 | 03-04-2026 01:08 PM | |
| 1 | 02-24-2026 12:59 PM | |
| 3 | 03-03-2026 10:33 AM |
| Online Status |
Offline
|
| Date Last Visited |
Wednesday
|