Skip to main content
Question

Command line scripting and GDB feature classes


gisdanny
Participant
Forum|alt.badge.img+1
Hi all,

 

I'm writing a script that should run workbench once for each feature class in a File Geodatabase.  For testing purposes I created a list of feature classes beforehand that I am passing to a subprocess call using python.  I'm basically invoking the windows command prompt to run workbench once for each feature class in my list.  In my workbench I've linked the Feature Types to Read to a user parameter which I pass the Feature Class name to in the subprocces call.  I'm getting a long, weird error message back each time the process is run & the workbench is failing each time.  When testing in workbench & giving the user parameter a Feature Class name everything is  kosher.

 

 

Any suggestions from the community?

 

 

Thanks!

4 replies

sigtill
Supporter
Forum|alt.badge.img+24
  • Supporter
  • May 7, 2013
Hi Danny!

 

 

1. What is the "long,weird error message"?

 

2. It MIGHT be a character-encoding issue?

 

3. It MIGHT be a filepath-issue?

 

4. It MIGHT be anything else...

 

 

Difficult to say unless we see a part or the complete log :)

gisdanny
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • May 7, 2013
Here's teh error message...

 

 

The clause 'TEST @EvaluateExpression(STRING_ENCODED,<at>Value<openparen>_length< closeparen>,Tester) < 8 ENCODED' within 'FACTORY_DEF * TestFactory FACTORY_NAME Tester INPUT FEATURE_TYPE StringLengthCalculator_OUTPUT TEST @EvaluateExpression (STRING_ENCODED,<at>Value<openparen>_length<closeparen>,Tester) < 8 ENCODED TEST  @EvaluateExpression(STRING_ENCODED,<at>Value<openparen>INSTALLATIONDATE<closepa ren>,Tester) > 1 ENCODED BOOLEAN_OPERATOR AND OUTPUT PASSED FEATURE_TYPE Tester_ PASSED OUTPUT FAILED FEATURE_TYPE Tester_FAILED' is incorrect.  TEST must look l ike: TEST <value> <operator> <value> Program Terminating

 


  • May 7, 2013
Hi Danny

 

 

How did you create your feature class list. With arcpy the content is utf16 coded, which you can force down using <string>.encode('ascii','ignore')

 

I came this problem across unraveling MXD contents when handling datasource, name, datasetName, definitionQuery etc.

gisdanny
Participant
Forum|alt.badge.img+1
  • Author
  • Participant
  • May 7, 2013
Given more time I would have used arcpy to grab the list of feature classes.

 

 

In this case I created a list (tuple actually) of FeatureClasses in Python manually.  I've triple checked all paths & spellings in this script so am confident there are no silly mistakes.  Here's my Python script if that helps shed any light:

 

 

import subprocess   # This is the path to the FME Workspace file you want to run. fmePath = r"\\\\pbi01wqa03.corp.local\\F$\\Test_ProcessData\\MD\\PEPCO\\fme\\State_Separation.fmw"   # This is the parameter name that you linked to "Feature Types to Read" tableParam = "Feature"   # List of Feature Classes to run. tables = ("A_Feature",     "PHI_AnchorGuy",     "PHI_Busbar",     "PHI_CapacitorBank",     "PHI_CircuitBreaker",     "PHI_FuseBank",     "PHI_Generator",     "PHI_NetworkTransformer",     "PHI_OHPrimary",     "PHI_OHSecondary",     "PHI_OpenPoint",     "PHI_OperationsNotesText",     "PHI_Pole",     "PHI_PoleLine",     "PHI_PrimaryConnectionPoint",     "PHI_PrimaryMeter",     "PHI_RecloserBank",     "PHI_RegulatorBank",     "PHI_SecondaryConnectionPoint",     "PHI_SecondaryNetworkSource",     "PHI_Sectionalizer",     "PHI_ServicePoint",     "PHI_SpanGuy",     "PHI_StreetLight",     "PHI_Substation",     "PHI_SurfaceStructure",     "PHI_SwitchBank",     "PHI_TransformerBank",     "PHI_UGPrimary",     "PHI_UGSecondary",     "PHI_UndergroundLinearStructure",     "PHI_UndergroundStructure",     "PHI_Vault")   # Run FMW once for each FeatureClass. for t in tables:     print "\\nRunning table " + t + " ...\\n"     subprocess.call("fme.exe " + fmePath + " --" + tableParam + " " + t , shell=True)     print "\\nTable " + t + " finished processing.\\n"      print "\\n\\nPress Enter to terminate script..." raw_input()

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings