Skip to end of metadata
Go to start of metadata


Did It Work?

When testing a script, you may find yourself in a situation where the script appears to be running, but doesn't seem to work. Furthermore, you may not see any error messages stating there is a problem. 

When a script doesn't perform to expectations and doesn't throw an exception, it can suggest a problem with the script's workflow. This page describes a couple of common scenarios.

Before You Begin...

Make absolutely certain that there isn't an Error Message Box hiding somewhere, otherwise you'll waste time applying the troubleshooting tips outlined below, when the real the error message was hiding in the background behind another window the whole time.

If a button component on a window is running a script, the output will be displayed on the Designer/Client Output Console. You can check for any error messages by navigating to the Console. From the Client menu bar, go to Help > Diagnostics and select the Console tab. From the Designer menu bar, select Tools > Console

On this page ...


Common Scenarios When Nothing Happens 

An Important Line Is Missing

Some critical part of your code is missing or commented out. It could be something simple, like your code is supposed to increment a value, but you forgot to write the line that increments the value. 

Pseudocode - Missing Code
myVar = 0

def doSomething():
	print "Doing work!"

# We're not modifying the value of myVar directly after it is initialized,
# so the current implementation of this code means the expression in our if-statement will never return True.
# Perhaps doSomething() returns a value that needs to be assigned to myVar.
if myVar == 10:
	doMoreStuff()


A quick way to test your code is by running your script in the Script Console before attaching it to a scripting event or specific component. You can see that running the code above in the Script Console that nothing happened, thus, suggesting an error. 

The Script Is Not Being Called

The script doesn't appear to be working because the mechanism that is supposed to be triggered hasn't been called. This can be caused by using the wrong event: (i.e., perhaps you placed the code on a Button's propertyChange event, when you meant to place it on actionPerformed).

Alternatively, perhaps you defined a function in your script, but you forgot to call the function. 

Additionally, if you're testing the script in the Designer, make sure it is in Preview Mode. Event based scripts will not run in the Designer unless it is in Preview Mode. 

Important Lines Are Being Skipped

This can be caused by incorrect indentation, or a misconfigured condition in an if-statement's expression.  For example, you used "==" when you meant to use "!=".  Verify that you are using the correct operators in if-statements.

Pseudocode - Skipping Code
myVar = 0

if myVar == 10:
	print "Hello, the value of myVar matches the condition in the if-statement"


Test your code for any errors by running your script in the Script Console. You can see nothing happened by running the code above in the Script Editor, once again suggesting an error.


Determining the Cause

The easier step to take when troubleshooting your script is to start adding print statements to your code. From here, you can start piecing together what the code is doing:

  • Print the value of variables to make sure they are coming in the way you expect.
  • Place print statements at the start and end of your code. This allows you to determine when your script is being called, and when it finishes. 
  • Adding a print statement before and after an if-statement can show you the flow of your script went as expected, or was filtered out by the if-statement.



  • No labels