Skip to main content
Solved

How to runarcpy scripts

  • October 31, 2018
  • 3 replies
  • 22 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

oscard
Influencer
Forum|alt.badge.img+22
  • Influencer
  • 344 replies
  • 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
  • 27 replies
  • 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+21
  • Safer
  • 648 replies
  • 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,

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