Working around ArcGIS Pro inability to export models as Python code?Copy Parallel editor tool - python script...

How to limit Drive Letters Windows assigns to new removable USB drives

How can I practically buy stocks?

Why was Germany not as successful as other Europeans in establishing overseas colonies?

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

Question about かな and だろう

How can Zone of Truth be defeated without the caster knowing?

Is the claim "Employers won't employ people with no 'social media presence'" realistic?

What is the origin of the term "plane of the spirit level"?

TIKZ - changing one block into parallel multiple blocks

Apply MapThread to all but one variable

As an international instructor, should I openly talk about my accent?

Contradiction proof for inequality of P and NP?

Why was primality test thought to be NP?

what is the sudo password for a --disabled-password user

Examples of subgroups where it's nontrivial to show closure under multiplication?

Could moose/elk survive in the Amazon forest?

What's a good approximation to the zeros of the cosine integral?

Why do distances seem to matter in the Foundation world?

What happened to Captain America in Endgame?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Checks user level and limit the data before saving it to mongoDB

Is there really no use for MD5 anymore?

555 timer FM transmitter

A ​Note ​on ​N!



Working around ArcGIS Pro inability to export models as Python code?


Copy Parallel editor tool - python script / modelbuilderDo ArcGIS Pro tasks support Python Toolbox tools which operate on Map Frames?Editing validation code for Python script tool in ArcGIS Pro using IDLE?Previewing table in ArcGIS Pro without adding to map?Avoiding arcgisscripting RuntimeError: Not signed into Portal from ArcPy with ArcGIS Pro?Debugging unexpected characters placed by ArcPy Python script tool in text element of ArcGIS Pro layout?Converting Layer off/on python code to script tool?Running models outside of ArcGIS Pro?Creating Layer objects in ArcGIS Pro; Python Environment LimitationsCollecting Moran's I output values in ArcGIS Pro?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















ArcGIS Pro 2.1 does not allow saving / exporting of a model constructed with ModelBuilder as a Python script.



It seems that the only way we can circumvent this limitation is to click on each individual geoprocessing history item, but, it is not very efficient to do so.



Is there another workaround?










share|improve this question




















  • 2





    If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

    – klewis
    Apr 9 '18 at 20:10






  • 4





    why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

    – ed.hank
    Apr 9 '18 at 21:57






  • 2





    May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

    – Hornbydd
    Apr 9 '18 at 23:47













  • @Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

    – Sharon D. Kenny
    Aug 20 '18 at 6:15








  • 1





    I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

    – Hornbydd
    Aug 20 '18 at 8:27




















4















ArcGIS Pro 2.1 does not allow saving / exporting of a model constructed with ModelBuilder as a Python script.



It seems that the only way we can circumvent this limitation is to click on each individual geoprocessing history item, but, it is not very efficient to do so.



Is there another workaround?










share|improve this question




















  • 2





    If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

    – klewis
    Apr 9 '18 at 20:10






  • 4





    why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

    – ed.hank
    Apr 9 '18 at 21:57






  • 2





    May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

    – Hornbydd
    Apr 9 '18 at 23:47













  • @Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

    – Sharon D. Kenny
    Aug 20 '18 at 6:15








  • 1





    I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

    – Hornbydd
    Aug 20 '18 at 8:27
















4












4








4


1






ArcGIS Pro 2.1 does not allow saving / exporting of a model constructed with ModelBuilder as a Python script.



It seems that the only way we can circumvent this limitation is to click on each individual geoprocessing history item, but, it is not very efficient to do so.



Is there another workaround?










share|improve this question
















ArcGIS Pro 2.1 does not allow saving / exporting of a model constructed with ModelBuilder as a Python script.



It seems that the only way we can circumvent this limitation is to click on each individual geoprocessing history item, but, it is not very efficient to do so.



Is there another workaround?







arcpy python modelbuilder arcgis-pro python-script-tool






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 9 '18 at 20:00









PolyGeo

54.1k1782247




54.1k1782247










asked Apr 9 '18 at 19:48









Sharon D. KennySharon D. Kenny

2316




2316








  • 2





    If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

    – klewis
    Apr 9 '18 at 20:10






  • 4





    why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

    – ed.hank
    Apr 9 '18 at 21:57






  • 2





    May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

    – Hornbydd
    Apr 9 '18 at 23:47













  • @Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

    – Sharon D. Kenny
    Aug 20 '18 at 6:15








  • 1





    I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

    – Hornbydd
    Aug 20 '18 at 8:27
















  • 2





    If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

    – klewis
    Apr 9 '18 at 20:10






  • 4





    why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

    – ed.hank
    Apr 9 '18 at 21:57






  • 2





    May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

    – Hornbydd
    Apr 9 '18 at 23:47













  • @Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

    – Sharon D. Kenny
    Aug 20 '18 at 6:15








  • 1





    I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

    – Hornbydd
    Aug 20 '18 at 8:27










2




2





If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

– klewis
Apr 9 '18 at 20:10





If you have ArcMap installed, perhaps export the Pro toolbox to 10.4 and then export the model to a script in ArcMap.

– klewis
Apr 9 '18 at 20:10




4




4





why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

– ed.hank
Apr 9 '18 at 21:57





why not just code it directly in python. modelbuilder is pretty clunky and spits out some crazy code about half the time for me anyway.

– ed.hank
Apr 9 '18 at 21:57




2




2





May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

– Hornbydd
Apr 9 '18 at 23:47







May be this is a good enough reason to get your employers to send you on a python scripting course? ESRI run courses as well as other training firms.

– Hornbydd
Apr 9 '18 at 23:47















@Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

– Sharon D. Kenny
Aug 20 '18 at 6:15







@Hornbydd: My agency has limited resources for training; therefore we are lacking opportunities to move forward in Python training. Esri's courses are above $1K, so due to the lack of funds, I have to learn on my own with free resources.

– Sharon D. Kenny
Aug 20 '18 at 6:15






1




1





I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

– Hornbydd
Aug 20 '18 at 8:27







I know money is tight but if they can't see the benefit of getting you up to speed in python it's their loss and ultimately going to cost them more in the long term. I agree esri courses are expensive but there is an industry out there selling training usually much cheaper.

– Hornbydd
Aug 20 '18 at 8:27












2 Answers
2






active

oldest

votes


















6














The reasons for the removal of this functionality are given at What happened To Export Script Button In ArcGIS Pro? by dflater-esristaff:




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.




I ceased exporting ModelBuilder models in ArcMap to Python code the day I discovered Copy As Python Snippet because the exported code was far harder to understand and debug due to the way it named variables, lacked understanding of iterators, etc.



I think it is far easier to learn ArcPy in ArcGIS Pro by using Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used, and then paste it into a script that you are writing.



Alternatively, if you want to quickly run your model using ArcPy, dflater-esristaff also describes a workaround of:




Start by building and saving a model, then create a new Python script
file (which is just a text file with .py extension), then using a text
editor or Python IDE add lines to the new script to import arcpy,
import the toolbox containing your model, and finally run the model.



...



import arcpy
arcpy.ImportToolbox(r"c:pathtotbxToolbox.tbx", "mytools")
arcpy.MyModel_mytools(r"c:modelinputsData.gdbInputFeatures")






share|improve this answer

































    0














    because of this fact, that the export-function is removed from the functionality of acrgispro, I never will use this program and so I hope arcgismap will have a very long "span of life"






    share|improve this answer








    New contributor




    Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "79"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f278769%2fworking-around-arcgis-pro-inability-to-export-models-as-python-code%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      6














      The reasons for the removal of this functionality are given at What happened To Export Script Button In ArcGIS Pro? by dflater-esristaff:




      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.




      I ceased exporting ModelBuilder models in ArcMap to Python code the day I discovered Copy As Python Snippet because the exported code was far harder to understand and debug due to the way it named variables, lacked understanding of iterators, etc.



      I think it is far easier to learn ArcPy in ArcGIS Pro by using Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used, and then paste it into a script that you are writing.



      Alternatively, if you want to quickly run your model using ArcPy, dflater-esristaff also describes a workaround of:




      Start by building and saving a model, then create a new Python script
      file (which is just a text file with .py extension), then using a text
      editor or Python IDE add lines to the new script to import arcpy,
      import the toolbox containing your model, and finally run the model.



      ...



      import arcpy
      arcpy.ImportToolbox(r"c:pathtotbxToolbox.tbx", "mytools")
      arcpy.MyModel_mytools(r"c:modelinputsData.gdbInputFeatures")






      share|improve this answer






























        6














        The reasons for the removal of this functionality are given at What happened To Export Script Button In ArcGIS Pro? by dflater-esristaff:




        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.




        I ceased exporting ModelBuilder models in ArcMap to Python code the day I discovered Copy As Python Snippet because the exported code was far harder to understand and debug due to the way it named variables, lacked understanding of iterators, etc.



        I think it is far easier to learn ArcPy in ArcGIS Pro by using Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used, and then paste it into a script that you are writing.



        Alternatively, if you want to quickly run your model using ArcPy, dflater-esristaff also describes a workaround of:




        Start by building and saving a model, then create a new Python script
        file (which is just a text file with .py extension), then using a text
        editor or Python IDE add lines to the new script to import arcpy,
        import the toolbox containing your model, and finally run the model.



        ...



        import arcpy
        arcpy.ImportToolbox(r"c:pathtotbxToolbox.tbx", "mytools")
        arcpy.MyModel_mytools(r"c:modelinputsData.gdbInputFeatures")






        share|improve this answer




























          6












          6








          6







          The reasons for the removal of this functionality are given at What happened To Export Script Button In ArcGIS Pro? by dflater-esristaff:




          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.




          I ceased exporting ModelBuilder models in ArcMap to Python code the day I discovered Copy As Python Snippet because the exported code was far harder to understand and debug due to the way it named variables, lacked understanding of iterators, etc.



          I think it is far easier to learn ArcPy in ArcGIS Pro by using Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used, and then paste it into a script that you are writing.



          Alternatively, if you want to quickly run your model using ArcPy, dflater-esristaff also describes a workaround of:




          Start by building and saving a model, then create a new Python script
          file (which is just a text file with .py extension), then using a text
          editor or Python IDE add lines to the new script to import arcpy,
          import the toolbox containing your model, and finally run the model.



          ...



          import arcpy
          arcpy.ImportToolbox(r"c:pathtotbxToolbox.tbx", "mytools")
          arcpy.MyModel_mytools(r"c:modelinputsData.gdbInputFeatures")






          share|improve this answer















          The reasons for the removal of this functionality are given at What happened To Export Script Button In ArcGIS Pro? by dflater-esristaff:




          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.




          I ceased exporting ModelBuilder models in ArcMap to Python code the day I discovered Copy As Python Snippet because the exported code was far harder to understand and debug due to the way it named variables, lacked understanding of iterators, etc.



          I think it is far easier to learn ArcPy in ArcGIS Pro by using Copy Python Command to copy the exact Python syntax needed to run the geoprocessing tool with the same parameter settings previously used, and then paste it into a script that you are writing.



          Alternatively, if you want to quickly run your model using ArcPy, dflater-esristaff also describes a workaround of:




          Start by building and saving a model, then create a new Python script
          file (which is just a text file with .py extension), then using a text
          editor or Python IDE add lines to the new script to import arcpy,
          import the toolbox containing your model, and finally run the model.



          ...



          import arcpy
          arcpy.ImportToolbox(r"c:pathtotbxToolbox.tbx", "mytools")
          arcpy.MyModel_mytools(r"c:modelinputsData.gdbInputFeatures")







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 9 '18 at 22:46

























          answered Apr 9 '18 at 22:38









          PolyGeoPolyGeo

          54.1k1782247




          54.1k1782247

























              0














              because of this fact, that the export-function is removed from the functionality of acrgispro, I never will use this program and so I hope arcgismap will have a very long "span of life"






              share|improve this answer








              New contributor




              Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                0














                because of this fact, that the export-function is removed from the functionality of acrgispro, I never will use this program and so I hope arcgismap will have a very long "span of life"






                share|improve this answer








                New contributor




                Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  0












                  0








                  0







                  because of this fact, that the export-function is removed from the functionality of acrgispro, I never will use this program and so I hope arcgismap will have a very long "span of life"






                  share|improve this answer








                  New contributor




                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  because of this fact, that the export-function is removed from the functionality of acrgispro, I never will use this program and so I hope arcgismap will have a very long "span of life"







                  share|improve this answer








                  New contributor




                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  share|improve this answer



                  share|improve this answer






                  New contributor




                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 16 mins ago









                  KarlKarl

                  1




                  1




                  New contributor




                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  Karl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f278769%2fworking-around-arcgis-pro-inability-to-export-models-as-python-code%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                      is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

                      Meter-Bus Содержание Параметры шины | Стандартизация |...