A function to enable|disable the Startup|Shutdown Python Script at once would be desirable.It is always very expensive if you have to comment out all lines just jor testing
+1 to Mike's comment re python startup/shutdown scripts. We use python scripts to send emails, run other workspaces etc and it would be great to easily disable this while developing and testing
This really needs to be implemented. Particularly since feature caching has been introduced. If I run my script to a particular transformer, it runs my python startup and shutdown script. If I then run to the next transformer (using cached features) it runs my startup and shutdown scripts again. Some of these scripts are not trivial, the startup script deletes a geometric network, the shutdown script turns off versioning on the datasets, rebuilds the geometric network and turns versioning back on again. This doesn't need to occur every time I want to follow the outputs of each transformer. Please enable a switch to ignore startup/shutdown scripts when running a translation.
Can you just create a start.txt and/or stop.txt file and populate it with "Debug" when you want to do testing and set it to something else otherwise? Then at the top of you python you could do:
import fme, fmeobjects
f = open("start.txt", "r")
if (f.readline() == "Debug"):
print("***** in Debug Mode, skipping normal startup *****")
One workaround in Python is to put triple double-quotes at the top ("""). This effectively converts the entire script into just a string, which Python does nothing with.
(PS: It doesn't really work if you use triple double-quotes within your script)
I have the same use case as @rchoucroun, namely non-trivial ArcPy-centric shutdown scripts that only make sense after a full translation, not during an exploratory re-imagining of a workspace when you have data caching turned on and are running up to particular transformers. Having a switch to disable either or both of startup and shutdown scripts (separately) would be useful and save time. This will encourage the centralisation of making full information products, not just the data, especially if you copy/paste Python code from ArcGIS Pro history entries.