POST
|
You are correct Jonathan, ListFields does maintain the field order. I must have been thinking of another list function. Thanks for the response. -Mark
... View more
07-05-2017
12:39 PM
|
0
|
0
|
277
|
POST
|
Is there a way to compare the attribute field order in one feature class against the order in another feature class using Python? This is essentially a schema check, but the Geodatabase Schema Compare tool in the Data Reviewer Tools Toolbox does not do this. ListFields in arcpy also does not report the fields in the order they appear in the attribute table. The geodatabase obviously maintains information on attribute field order, so is there a way to access that information? The two feature classes have the same attribute fields, they just could be in a different order. The schema standard we use calls for a specific attribute field order (and it's not necessarily alphabetical order). Thanks for any help/ideas. Mark
... View more
06-29-2017
03:39 PM
|
0
|
2
|
734
|
POST
|
Got it working by creating an mpArgs variable and setting it equal to the string of arguments needed, with the first argument being the path and file name of the executable. Then the mpArgs variable is passed to subprocess.Popen(). Still not sure why the previous construction of the arguments directly in subprocess.Popen didn't work. Successful code below... #Set variables for passing arguments to the mp program mpPath = "pathToProgram" workSpace = "folderContainingFilesToProcess" #Create a list of files in the workspace and run them through mp fileList = os.listdir(workSpace) for file in fileList: print "Processing " + file mpArgs = os.path.join(mpPath, "mp.exe") + " -e " + os.path.join(workSpace, file[:-4]) + ".err " + os.path.join(workSpace, file) subprocess.Popen(mpArgs)
... View more
02-15-2016
03:18 PM
|
1
|
0
|
676
|
POST
|
Script variations I have tried so far... mpPath = "pathToProgram" workSpace = "folderContainingFilesToProcess" fileList = os.listdir(workSpace) for file in fileList: print "Processing " + file os.execv(os.path.join(mpPath, "mp"), ["mp", "-e " + os.path.join(workSpace, file[:-4]) + ".err", os.path.join(workSpace, file)]) I have also substituted the following for the os.execv line: subprocess.Popen([os.path.join(mpPath, "mp.exe"), '-e ' + os.path.join(workSpace, "CemeteryOrBurialSite_P") + '.err', os.path.join(workSpace, "CemeteryOrBurialSite_P.xml")]) And I've tried subprocess.call and subprocess.check_call instead of Popen. And I've tried taking it out of the For loop and hardcoding the file name and path.
... View more
02-15-2016
01:56 PM
|
0
|
0
|
676
|
POST
|
I have a program that is normally run from the Windows Command Prompt. The program processes a single file at a time and creates an error log file. I would like to use Python to batch process multiple files in a folder, but I am having no luck at using Python to execute the program. I have tried the subprocess module (both subprocess.call and subprocess.Popen), but the program doesn't seem to run at all or at least doesn't produce the log file. I have also tried os.execv with limited success - the program executed and produced the error log, but then terminated the script after processing the first file with the error message "EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host." Can anyone point me in the right direction to get me started? Thanks! Mark
... View more
02-15-2016
01:21 PM
|
0
|
3
|
3162
|
POST
|
Not the exact script from the Help, but a similar one: import arcpy from arcpy import env env.workspace = {full path to the database} arcpy.Compact_management(env.workspace) I also tried setting a variable equal to the workspace and then running the Compact on the variable rather than directly on the env.workspace with the same results. I initially ran the above script on the database after adding some non-spatial tables to it and noticed the size increase. I then compacted the database using ArcCatalog, right-click, Administration>Compact database and found that it dropped the size by 1/3. I then reran the same script on the same database and it inflated the size. Compacting through ArcCatalog dropped it back down. If it helps, I'm running Windows 7 and ArcGIS 10.2.2.3552.
... View more
02-04-2016
12:14 PM
|
0
|
1
|
439
|
POST
|
When using Compact_management in Python it actually makes the geodatabase larger. Has anyone else noticed this, or any ideas as to why this might be happening? I'm using it on a file geodatabase. When I right-click on it in ArcCatalog and use the Administration>Compact Database command it compacts down to about 6.6 MB. When I run the Python script it inflates it to about 9 MB. Any ideas or suggestions would be greatly appreciated!
... View more
02-04-2016
10:52 AM
|
0
|
3
|
1891
|
IDEA
|
-->
It would be nice if the Attribute Window would follow the same appearance rules as set in the attribute table regarding viewing coded value domain and subtype descriptions.
... View more
04-19-2012
11:36 AM
|
5
|
1
|
237
|
Title | Kudos | Posted |
---|---|---|
1 | 02-15-2016 03:18 PM | |
5 | 04-19-2012 11:36 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|