Question

How to stop startup/shutdown python from running


Badge
Hi,

 

I've inhereted a workspace that comes with large chunks of Python that are run on startup/shutdown. I'm debugging the workspace and don't want them to run while I do so (it can't run in fact; I lack the necessary modules on my local machine). What's the best way to stop them running?

 

 

The best I can think of is a parameter (DEBUGGING), that I check, and if it's set I terminate the Python with:

 

  
     sys.exit()
 

 

Unfortunately, sys.exit() works by raising an exception (<SystemExit>), and FME interprets this as an ERROR level event and terminates the workspace.

 

 

So how can this be done short of deleting the python entirely? (my current solution)

 

Thanks, 

Jonathan


2 replies

Userlevel 4
Hi

 

 

what I use is to define a private paramet, e.g. called "DEBUG" that I set to either 1 or 0.

 

 

You can the surround you scripts or blocks with an if-statement, like:

 

 

if FME_MacroValues['DEBUG'] == '0':

 

    blablabla...

 

 

David
Badge
Hi David,

 

Thanks for the answer. That had occured to me but I was hoping for something more elegant.

 

It also occurs to me that something like this would be useful for the other startup/shutdown scripts (so SQL and TCL). I can't think of a way to do it for SQL at all.

 

Thanks,

 

Jonathan

Reply