I recently began using the Pro Notebook. I used to operate like a caveman and simply use a Python interpreter independently of ArcMap. BUT, Pro has the integrated Notebook which is great. I am however curious how to display two things: 1) Generally results after running each cell. 2) Within that, arcpy results.
For instance I write some utility functions like this (obviously something not just wrapping an arcpy function, but just for simplicity)
# located in c:/users/zach/code/arcpy_abstractions.py def move_feats(fcs_in, fp_out, fcs_name_out): arcpy.FeatureClassToFeatureClass_conversion(fcs_in, fp_out, fcs_name_out)
Imagine the below code block is a cell in the notebook
sys.path.append('c:/users/zach/code') from arcpy_abstractons import move_feats fcs_in = 'path/to/fcs_to_move' fp_out = 'path/to/another_gdb' fcs_name_new = 'fcs_renamed' move_feats(fcs_in, fp_out, fcs_name_name)
However, once I run this cell I can immediately run another cell EVEN if the cell and particularly the arcpy function is still processing. Is there a way to show a progress bar or any indication that the cell has completed its operations? I want to move and delete multiple files by basically looping through a pandas dataframe, so I need to know the current progress. I am utilizing logging and print statements, but that's too indirect.
The only thing remote applicable from the arcpy-ish world would be the progressbar
which I doubt would work in a notebook.
It comes up as topics in Jupyter Notebook and Jupyter Lab,
But I haven't explored them... I just get coffee if I suspect something will take some time 😉
Thanks Dan! The Reset Progressor seems promising - but it would be nice to have a solution that would work in multiple development environments (for lack of a better...understanding of terminology on my end). At some point I'd like to get over to Spyder or PyCharm. You have advised me in the past on similar endeavors - via forum responses. I'm waiting for a project to end so I can update ArcMap from 10.6 to 10.8 and THEN attempt to fix problems with my Python environment. THEN jump into Spyder (as you prostelytized within the last year or two). The Notebook is really cool, particularly for training coworkers (and myself). Alas, for now print statements and logging for some semblance of real time status...BUT! I'll sprinkle a few ResetProgressor statements in my code and see how that fares for now.
Zachary... note... ResetProgressor is one of a series of methods, it just happened to be at the top of the table of contents listing for creating and working with progress bars.
Also... Spyder has a Notebook addon which I use when I don't feel like working in Pro, or on browser incarnations of Jupter Notebook, JupyterLab
While the code is still executing, the cell number will be displayed as
When the cell finished running, the number will be displayed as
Personally, I add a print statement to the end of each cell...