Skip to main content
Question

How to stop startup/shutdown python from running

  • May 20, 2015
  • 2 replies
  • 52 views

Forum|alt.badge.img
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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

david_r
Celebrity
  • May 20, 2015
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

Forum|alt.badge.img
  • Author
  • May 20, 2015
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