Solved

How to runarcpy scripts

  • 31 October 2018
  • 3 replies
  • 9 views

Badge

Hello,

I would like to run simple maintenance arcpy scripts on feature classes after a load. Without reading those feature classes.

 

Example of scripts: attribute index, spatial index, extent calculation:

 

arcpy.AddIndex_management(in_table="C:/Users/xxx/Documents/ArcGIS/Default.gdb/tablename", fields="Name", index_name="name_1", unique="NON_UNIQUE", ascending="NON_ASCENDING")

arcpy.RecalculateFeatureClassExtent_management(in_features="C:/Users/xxx/Documents/ArcGIS/Default.gdb/tablename")

 

For both file geodatabase feature classes and Enterprise Geodatabase.

 

How do I achieve this with either a shutdown python script or PythonCaller / Creator?

 

Thanks

icon

Best answer by oscard 31 October 2018, 17:44

View original

3 replies

Userlevel 2
Badge +19

Take a look at this article: https://knowledge.safe.com/articles/47216/using-arcpy-for-fme-feature-processing.html

 

I guess you will need to change your Python interpreter to the one that has the arcpy module

Badge

Hi @oscard

Thanks a lot, I was able to make it work. Is there any way I can be switching to the custom interpreter with a script or some command before running the translation and then set it back to default after the translation?

 

Thanks,

Userlevel 3
Badge +17

Hi @oscard

Thanks a lot, I was able to make it work. Is there any way I can be switching to the custom interpreter with a script or some command before running the translation and then set it back to default after the translation?

 

Thanks,

Hi @honkovam

How did you change the Python interpreter in your workspace? If you used the workspace's Python Compatibility parameter (eg. set to Esri ArcGIS Desktop Python 2.7), no further action should be required as changes to this parameter only applies to the current workspace.

Edit: This applies to FME 2017 and 2018 only

Reply