I updated to the new version of ArcGIS Pro 1.1.0 and the export script is gone. Is there a way to get it back?
The ability to export from ModelBuilder to a Python script was removed from ArcGIS Pro 1.1 because it did not match user expectations to provide a one-to-one export of your model to Python. The scripts generated by exported models were missing nested sub-models, and did not include iterators, feedback loops, and in-line variable substitution. Models with these components would require major changes that most people who use Export are not able to make themselves. There is currently no plan to add this capability back into ArcGIS Pro.
ModelBuilder export to Python was often used by those who wanted to learn the Python syntax for a geoprocessing tool, or who wanted a Python script that could execute their existing workflow of geoprocessing tools. Others wanted a Python script so the workflow could be run through Windows Task Scheduler. You can use these alternatives to accomplish these goals:
I'm trying this method but I keep getting the following error:
"SyntaxError: invalid or missing encoding declaration"
when it gets to the 2nd line to actually run my model.
In ArcGIS Pro you can copy the Python syntax for any geoprocessing tool you have run. Go to Project>Geoprocessing History, right-click any tool, and select Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used.
In version 2.2 if I open the History tab in Catalog, it's always empty.
If I go to the Analysis ribbon and clieck History, it just exposes the same empty history tab in Catalog.
Is there some other History feature tucked away that I am not seeing?
Thinking that perhaps the History feature itself is broken I tried running a "buffer" operation and indeed it did work.
Is there some way to make a model generate history?
I found an option to put history into an XML file under %APPDATA%. It seemed to create a folder but puts nothing in it. I found option to put into metadata, I can't see that it works.
This is really disappointing. The capability in ArcGIS and in ArcGIS Pro 1.1 was not good enough and instead of making it better the solution was to get rid of it.
I can see many uses to exporting models as scripts even if they don't work perfectly. Prototyping to the the logic of a tool (that is how I used to use it), having a text ".py" file that easily editable to be used as a scheduled task.
Some of the workarounds recommended work, however I really would have liked to see improvement of the software rather than a loss of capabilities.
The history tab does not seem to work for me on ArcGIS pro 2.2. If it worked I would have been able to copy the execution of my model as a a python snippet.
Please ESRI can you help?
Have you seen and voted up this idea: Add Export Model to Python Script back to ArcGIS Pro ?
I'm pretty sure that is the current plan - to make the export better, able to handle most of those things that it wasn't able to before as well as incorporate other ideas we've had from customers on how to make it better. The idea I'm pointing to has a status of Under Consideration. I'll check with the team to see if it might be ready to update it's status.
It shows that this functionality that was originally in Pro and has been in ArcMap for many years is In Product Plan so it will hopefully be added in the next release or 2 as per link Kory provided above. This idea (which is how ESRI wants users to request important functionality from ArcMap be ported to Pro - should this really be necessary if the functionality was proven effective in previous software) has been steadily gaining points as it was under 2,000 points 10 months ago.
Here it is in a daily build of 2.4:
Retrieving data ...