Skip to main content
Solved

How to runarcpy scripts


Forum|alt.badge.img

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

Best answer by oscard

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

View original
Did this help you find an answer to your question?

3 replies

oscard
Influencer
Forum|alt.badge.img+21
  • Influencer
  • Best Answer
  • October 31, 2018

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


Forum|alt.badge.img
  • Author
  • October 31, 2018

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,


debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • October 31, 2018
honkovam wrote:

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


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